Skip to content

Instantly share code, notes, and snippets.

@luke-gru
Created July 13, 2011 20:54
Show Gist options
  • Save luke-gru/1081303 to your computer and use it in GitHub Desktop.
Save luke-gru/1081303 to your computer and use it in GitHub Desktop.
<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>
@luke-gru
Copy link
Author

seems like too much work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment