<html> <head> <title>Coloque o título aqui</title> </head> <body bgcolor="#E5E5E5"link="#0000FF" vlink="#800080"gt; Insira aqui os textos, imagens, tabelas... </body> </html>
Relógio na barra de status
No body colocar: <body onLoad="startclock()">
<script language="JavaScript"> var timerID = null; var timerRunning = false; function startclock () { stopclock(); time(); } function stopclock () { if(timerRunning) clearTimeout(timerID); timerRunning = false; } function time() { var now = new Date(); var ampm = (now.getHours() >= 12) ? " P.M." : " A.M." var hours = now.getHours(); hours = ((hours > 12) ? hours - 12 : hours); var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes(); var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); var Time=(hours + minutes + seconds + " " + ampm ); window.status=Time; timerID = setTimeout("time()",1000); timerRunning = true; } function clearStatus() { if(timerRunning) clearTimeout(timerID); timerRunning = false; window.status=""; } </script>
Contagem de tempo na página
No body colocar: <body onLoad="window.setTimeout('getSecs()',1)">
<script language="JavaScript"> startday = new Date(); clockStart = startday.getTime(); function initStopwatch() { var myTime = new Date(); var timeNow = myTime.getTime(); var timeDiff = timeNow - clockStart; this.diffSecs = timeDiff/1000; return(this.diffSecs); } function getSecs() { var mySecs = initStopwatch(); var mySecs1 = ""+mySecs; mySecs1= mySecs1.substring(0,mySecs1.indexOf(".")) + " segundo(s)"; document.forms[0].timespent.value = mySecs1 window.setTimeout('getSecs()',1000); } document.write ("<form><input size=15 name=timespent></form>") </script>
Proteger código
<script language="JavaScript"> function protegercodigo() { if (event.button==2||event.button==3) { alert('Aha, não falei que era protegido?!');} } document.onmousedown=protegercodigo </script>
Não se esquça de experimentar em cima num pequeno e fácil editor de HTML. Divirta-se!!