Question: Code example 7-1 1. var eventHandler = function(evt) { 2. if (!evt) { evt = window.event; } 3. if (evt.preventDefault) { 4. evt.preventDefault(); 5. }

Code example 7-1 1. var eventHandler = function(evt) { 2. if (!evt) { evt = window.event; } 3. if (evt.preventDefault) { 4. evt.preventDefault(); 5. } 6. else { 7. evt.returnValue = false; 8. } 9. };

(Refer to code example 7-1) This is cross-browser compatible code that cancels the default action for an event. What do lines 3 - 5 do?

They cancel the default action of the event for all modern browsers.

They cancel the default action of the event for older versions of IE.

They check to see if the page is DOM-compliant.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!