Created
June 14, 2013 01:30
-
-
Save yramagicman/5778781 to your computer and use it in GitHub Desktop.
Is this a bug? Or a feature?
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"> | |
<title>Clock</title> | |
</head> | |
<body> | |
<div id="clock"> | |
<!-- well, I've got my clock div, and I'm going to make it work with JS --> | |
</div> | |
<script type="text/javascript" charset="utf-8"> | |
// Here's where things get strange. I'm supposed to have to query the dom | |
// element whenever I want to do something with it. but apparently that's | |
// not the case here. In the latest production versions of Chrome, Safari, | |
// Firefox, and Opera this works. I can leave 'var things' commented out and | |
// everything works just great. WHAT?! Is this a good idea? Can we ditch the | |
// DOM part of jQuery and every other js library in 3 years or less? | |
//var things=document.getElementById('clock'); | |
setInterval(function(){ | |
var time= new Date( ); | |
clock.innerHTML= time.toTimeString() | |
}, 1000) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment