What we learnt from this exercise is almost all the Javascript in the login 
page is buggy in some way, and most of it can be removed because it serves no 
useful purpose. In Dan's case, it was the IE8 detection but there are other 
areas of concern. Take this little gem:

/*
 * This function detects users key presses and sumbits the form
 * if the return key is hit.
 */
function doSubmit(evt) {
    var keycode;

    // extract key code from event
    if (navigator.appName.indexOf("Netscape") != -1)
        keycode = evt.which;
    else if (navigator.appName.indexOf("Microsoft") != -1)
        keycode = window.event.keyCode;

    // detect the "Return" key
    if (keycode == 13) {
        doLogin();

        if (navigator.appName.indexOf("Microsoft") != -1)
            // stop System Default Beep Sound.
            window.event.keyCode = 0;
    }
}

The purpose is to detect a user pressing enter in a field to submit a form, 
which is further made complicated by browser/key code/event complications 
across browsers. However, if a listener had been correctly added to a form, the 
browser would do all this for free. Therefore, it only serves to increase the 
number of support issues.

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to