Question

In: Computer Science

what is the benefit of using DOM2 event model rather than DOM0? Explain with an example...


what is the benefit of using DOM2 event model rather than DOM0? Explain with an example
please exaplain with a basic example
thanks in advance

Solutions

Expert Solution

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>

Related Solutions

What are the advantages of a using a linked list rather than a conventional array in...
What are the advantages of a using a linked list rather than a conventional array in Java? and when would it be more efficient to use an array rather than a linked list? Explain your answer.
Explain John Robinson's model with example of a country other than India.
Explain John Robinson's model with example of a country other than India.
Explain Harris Todaro model with example of a country other than India.
Explain Harris Todaro model with example of a country other than India.
What is the advantage of using max wavelength rather than the wavelength nearby such as 580...
What is the advantage of using max wavelength rather than the wavelength nearby such as 580 nm? This is for the Bradford protein assay where the maximum of the absorbance spectrum is at 595 nm.
(1) What are the advantages and disadvantages to using the int data type rather than the...
(1) What are the advantages and disadvantages to using the int data type rather than the bool data type to manipulate Boolean expressions? Why do students think the int data type is still used for Boolean expressions? (2) Discuss how C++ provides two-way selection through the if…else statement. Explain the syntax of this statement. Also, explain how the bool data type is used in C++ to manipulate Boolean expressions.
1. What is the main benefit of using the OSI reference model? 2. What are the...
1. What is the main benefit of using the OSI reference model? 2. What are the pros and cons of using SMF optical cable? 3. What is a patch cable used for? 4. What is the difference between a E1 and a T1 leased line? 1. What part of TCP/IP provides flexibility? 2. What Ethernet class (A, B or C) is most used? Why? 3. Why is subnetting used? 4. (3 points): What is a layer 3 switch?
True or False Management may be tempted to make decisions that benefit themselves rather than the...
True or False Management may be tempted to make decisions that benefit themselves rather than the shareholders they represent. Management compensation, however, can be structured to better align management interests with shareholder interests.
Briefly explain the potential benefits of using monetary policy rather than fiscal policy to stabilise the...
Briefly explain the potential benefits of using monetary policy rather than fiscal policy to stabilise the economy (200 word limit).
Explain what benefits might exist if a market is served by a monopoly rather than by...
Explain what benefits might exist if a market is served by a monopoly rather than by many competitive firms. (Include at least 3 benefits).
What is the purpose of section 1245 and 1250? Explain rather than describe them.
What is the purpose of section 1245 and 1250? Explain rather than describe them.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT