<html> <head> <title>Javascript Testbed</title> <script type="text/javascript"> function display_c(){ var refresh=1000; // Refresh rate in milli seconds mytime=setTimeout('display_ct()',refresh) } function display_ct() { var strcount var x = new Date() document.getElementById('ct').innerHTML = x; tt=display_c(); } function display_ct() { var strcount var x = new Date() var x1=x.toUTCString();// changing the display to UTC string document.getElementById('ct').innerHTML = x1; tt=display_c(); } function hideElement(id_attribute_value) { if (document.getElementById && document.getElementById(id_attribute_value) && document.getElementById(id_attribute_value).style ) { document.getElementById(id_attribute_value).style.visibility = "hidden"; }; } </script> </head> <body onload=display_ct();> <h1> Javascript will find out the date and the browser. </h1> <button type="button" onclick="hideElement('d1');">hide div</button> <span id='ct' ></span> </body> </html>
The button doesn't clear the time --- any suggestions?