Highlights
All Snippets
Top 100 Snippets
Librarians
gbCodeLib

By Language
VB6
JavaScript
Perl
HTML
SQL
Java
DOS

GBIC >> Source Code >> JavaScript >> Snippet

Display date-time on a web page + updates


< html >
< head >
< script >
function showTime() {
    var rightNow = new Date ()
    var lstring = rightNow.toLocaleString()
   document.DT.CurrentTime.value = lstring
   setTimeout( 'showTime()' , 1000)
}
</ script >
< body onload = 'showTime();' >
< h1 > My Page </ h1 >
< form name = "DT" >
< input type = "text" name = "CurrentTime" value = "" size = 30 >
</ form >
</ body >
</ html >