11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

As with more traditional models, DOM Level 2 allows you to cancel the default action<br />

associated with an event by returning false from a handler. It also provides the<br />

preventDefault() method of Event objects. If, at any time during an Event‘s lifetime, a handler<br />

calls preventDefault(), the default action for the event is canceled. This is an important point: if<br />

preventDefault() is ever called on an event, its default action will be canceled; even other<br />

handlers returning true cannot cause the default action to proceed.<br />

<strong>The</strong> following simple example prevents clicks anywhere in the document from having their<br />

intended effect.<br />

Try clicking this link.<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!