Relógio / Hora em Javascript
Publicado por Leandro Alexandre ® 05/01/2009
[ Hits: 14.321 ]
Client-side.
Exibe a hora do usuário que esta acessando a página.
<html>
<title>Relógio / Hora em  Javascript</title>
<script language="javascript">
var timerID = null;
var timerRunning = false;
function stopclock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false;
}
function startclock()
{
    stopclock();
    showtime();
}
function showtime()
{
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var timeValue = "" + ((hours > 12) ? hours - 12 : hours);
    timeValue  += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue  += ((seconds < 10) ? ":0" : ":") + seconds;
    timeValue  += (hours >= 12) ? " P.M." : " A.M.";
    document.clock.face.value = timeValue;
    timerID = setTimeout("showtime()",1000);
    timerRunning = true;
}
//-->
</script>
<form name="clock" onSubmit="0">
  <input type="text" name="face" size="12">
</form>
<body>
<script>startclock();</script>
<hr width=40% align=left>
Hora em Javascript<br/>
www.leandro.adm.br
</body>
</html>
Funções para converter de moeda para float e vice-versa
Assinatura nas postagens no Viva o Linux
Nenhum comentário foi encontrado.
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Atualizando o Fedora 42 para 43
Como saber se o seu e-mail já teve a senha vazada?
Como descobrir se a sua senha já foi vazada na internet?
Mint Xfce não mantém a conexão no wi-fi (1)
Problemas com Driver NVIDIA (5)
Warcraft II Remastered no Linux? (8)









