Created
May 5, 2013 15:34
-
-
Save bingeboy/5521142 to your computer and use it in GitHub Desktop.
Dom2 Event Example
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> | |
<title>Basic Dom2 Event Handler And Bubble Test</title> | |
</head> | |
<body> | |
<div id="container"> | |
<ul id="listContainer"> | |
<li id="item1">item1</li> | |
<li id="item2">item2</li> | |
</ul> | |
</div> | |
<script type="text/javascript" charset="utf-8"> | |
var el = document.getElementById('listContainer') | |
// DOM 2 event. This is basic example and will have issues with IE. | |
el.addEventListener('mouseover', function(){ | |
alert('mouseover'); | |
}, false); | |
el.addEventListener('click', function(){ | |
alert('click!'); | |
}, false); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment