Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started