Created
May 19, 2013 06:24
-
-
Save bingeboy/5606878 to your computer and use it in GitHub Desktop.
DOM2 Events
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