KidsLovePC Contact Us
  Home   PHP  Graphics ASP  JavaScript   J2EE  HTML  JAVA   Swing   Webtip  Forums  Lyric  Free sheet music  Ringtones

Best books about Javasript

JavaScript Simple Clock

javascript, javascript detect chinese input formSee the following javascript simple clock.

javascript, javascript detect chinese input formHow to do it?

Javascript uses timer to dynamically update the text in the text field. Copy the following javascript to <head> section


<SCRIPT>

var tick;

function stop() {

  clearTimeout(tick);

  }

function simpleClock() {

  var ut=new Date();

  var h,m,s;

  var time="    ";

  h=ut.getHours();

  m=ut.getMinutes();

  s=ut.getSeconds();

  if(s<=9) s="0"+s;

  if(m<=9) m="0"+m;

  if(h<=9) h="0"+h;

  time+=h+":"+m+":"+s;

  document.sclock.stime.value=time;

  tick=setTimeout("simpleClock()",1000);  

  }

</SCRIPT>

 

Add onLoad="simpleClock();" onUnload="stop();" to <body> tag.

 

 

 

 

Best books about ASP & ASP.Net from Amazon
JavaScript Bible, Fifth Edition (Paperback) JavaScript & DHTML Cookbook (Paperback) JavaScript: The Definitive Guide (Paperback) Beginning JavaScript Second Edition (Paperback) JavaScript: The Complete Reference, Second Edition (Paperback)

 

Printer Inkjet A Z lyricsLearn ChineseHome|PHP|Swing|HTML|JavaScript|ASP|JAVA|Forum|WebTip|Contact Us
Copyright © kidslovepc.com All rights reserved(new). Privacy|Copyright
designed by info@kidslovepc.com

Please help us cover the web site maintenance fee.
barcode scanner Thermal Printer credit card machine bar code printer