Cancels the default action (response) of the browser on the event (for example, the jump of the & lt; a & gt; tag) and stops the event propagation.
Function Description
Cancel the default action (response) of the browser on the event (such as the jump of the tag) and stop the event from spreading.
Implementation Code
| Function stopEvent (evt) {var evt = evt | window. event; if (evt. preventDefault) {evt. preventDefault (); evt. stopPropagation ();} else {evt. returnValue = false; evt. cancelBubble = true ;}} |
Only prevent the event from spreading (do not cancel the default action)
| Function stopEvent (evt) {var evt = evt | window. event; if (evt. stopPropagation) {evt. stopPropagation ();} else {evt. cancelBubble = true ;}} |
Only cancel the default action (do not stop the event from spreading)
| Function stopEvent (evt) {var evt = evt | window. event; if (evt. preventDefault) {evt. preventDefault ();} else {evt. returnValue = false ;}} |