Created
July 13, 2011 20:54
-
-
Save luke-gru/1081303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script> | |
var debug = true; | |
var main = function display_time( ) { | |
var d = new Date( ); | |
var h = d.getHours( ); | |
var m = d.getMinutes( ); | |
var ampm = (h >= 12) ? "PM" : "AM"; | |
if (h > 12) h-= 12; | |
if (h === 0) h = 12; | |
if (m < 10) m = "0" + m; | |
var time = h + ":" + m + "" + ampm; | |
document.write("<h1>" + time + "</h1>"); | |
setTimeout("display_time( )", 30000); | |
} | |
onerror = message( ); | |
function message( ) { | |
if (window.debug === true) { | |
try { | |
window.main( ); | |
} catch(e) { | |
txt = "There was a JS error \n"; | |
txt += e.message; | |
alert(txt); | |
} | |
} | |
} | |
</script> | |
</head> | |
<body onload="main( );"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
seems like too much work