SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Oct 2002
    0 Post(s)
    0 Thread(s)

    Question sitepoint-book "javascript and dom"code: javascript gurus please help

    Hello !

    I need some help from javascript-experts with the form-valdidation-code (chapter 6) in
    Stuart Langridge's Sitepoint-book "dhtml utopia: modern webdesign using javascript and dom"

    the function checkValidSubmit contains the following code, which stops
    event-bubbling and the default-action:

    if (e && e.stopPropagation && e.preventDefault) {
    if (window.event) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
    return false;

    the first if-statement is for dom-standard-browser, the second if-staement is for internet

    my first question: why is there a return false statement?

    reading stuarts book pages 57-58 I think return true is only needed to cancel the event in the
    Safari-browser, which needs an old-style onclick-eventhandler and
    the statement return false does cancel this ???

    but: as the code checks the existence of window.event for me it seems like the safari-browser is never
    "seeing" the return false statement and for internet-explorer it is not necessary ???

    my second question:
    whats the need of the following code??

    checkSubmit: function() {
    if (this.attachEvent) return true;
    return this.submitAllowed;

    the explanation on book-page 142 is cryptic to me

    Thanks in advance for any help and please apologize for my bad English

    Last edited by Kurt; Jul 23, 2006 at 10:44.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts