[h1]Javascript Clock[/h1]
Okay This Is My First Tut here. tested and working nicely. you may use the code to your liking. this is not that hard to build. it was rather fun
this is the beginning tags for your html document
<html>
<title></title>
<head>
<center><script language="JavaScript">
<!--
function startclock()
{
var thetime=new Date();
var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var AorP=" ";
if (nhours>=12)
AorP="P.M.";
else
AorP="A.M.";
if (nhours>=13)
nhours-=12;
if (nhours==0)
nhours=12;
if (nsecn<10)
nsecn="0"+nsecn;
if (nmins<10)
nmins="0"+nmins;
document.clockform.clockspot.value=nhours+":"+nmins+":"+nsecn+" "+AorP;
setTimeout('startclock()',1000);
}
//-->
</SCRIPT>
</head>
this goes into your header tags. this is where the script first fires.
this next part you would stick into the body of your page left, right , center. where ever it may be that will display you time.
<BODY onLoad="startclock()">
<FORM name="clockform">
<b>Time:</b> <INPUT TYPE="text" name="clockspot" size="10">
</form></center>
close the document with the last tags ans save as an html page
</body>
</html>
Example Page:
Click here to see an example of this script.If you like this tutorial, please
Click Here to register.
Click the link below to download the HTML file for this tutorial.
Javascript Clock HTML