irt.org Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt

Q1303 Why might you use "return functionName()" in an event handler as opposed to "functionName()"?

You are here: irt.org | FAQ | JavaScript | Event | Q1303 [ previous next ]

If the functionName() function updates the status message then the event handler has to return true for it to be effective (especially true for older browsers.)

It returns the value that the functionName() function returns to the event that invokes the event handler.

Basically you are saying, by returning true to the event, "yep, go ahead and do whatever", or by returning false to the event, "nope, cancel that".

©2013 Martin Webb

ArticlesFAQsGamesFeedback

FOLDOCRFCsInstant JavaScriptSoftwareBooksJavaScript Programmer's ReferenceAboutTop