In: Computer Science
DOM2 Style: Alternatively known as DOM2 CSS, this gives you the ability to access and manip- ulate all your CSS-related styling and rules.
DOM2 Traversal and Range: These give you iterative access to the DOM, so you can walk and manipulate the document as needed.
<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> |