Home > Web Front-end > JS Tutorial > Right-clicking on a web page does not support event.preventDefault and event.returnValue (need to add window)_javascript skills

Right-clicking on a web page does not support event.preventDefault and event.returnValue (need to add window)_javascript skills

WBOY
Release: 2016-05-16 17:41:46
Original
1320 people have browsed it

The event.preventDefault() method is the default behavior for canceling events, but this method is not supported by IE. In IE, you need to use window.event.returnValue = false; to implement it.

Copy code The code is as follows:

function stopDefault( e )

{

if ( e && e.preventDefault ){ e.preventDefault();

} else { window.event.returnValue = false;

} }

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template