DaveXP Posted September 1, 2003 Share Posted September 1, 2003 Here is some Javascript code for a clock that gets the time for the part of the world you live in.<HTML><body onload = "tick()" text="#FFFFFF" bgcolor="#000000" ><script type = "text/javascript" ><!--function tick(){var now = new Date();var offset = now.getTimezoneOffset();var msg;switch(offset){case 240 : msg = "East Coast"; break;case 300 : msg = "Central"; break;case 360 : msg = "Mountain"; break;case 420 : msg = "Pacific"; break;default : msg = "all";}var hh = now.getHours(); if( hh <= 9 ) hh = "0" + hh;var mn = now.getMinutes(); if(mn <= 9 ) mn = "0" + mn;var ss = now.getSeconds(); if( ss <= 9 ) ss = "0" + ss;var tt = hh + ": " +mn+ ": " + ss;document.f.clock.value = tt;window.setTimeout( "tick()", 1000 );}//--></script><form name = "f" ><font color="#FF0000"><input name= "clock" type = "text" SIZE = "10"></font> Current Time</form></body></HTML> My first Javascript code Link to comment Share on other sites More sharing options...
b0r3d Posted September 1, 2003 Share Posted September 1, 2003 Well done! Link to comment Share on other sites More sharing options...
DaveXP Posted September 1, 2003 Author Share Posted September 1, 2003 Well done! Thank You Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now