简体   繁体   中英

Strange JavaScript Code Appearing in Form Validation Error Notification on IE 6-8

I have an HTML5 form that uses JavaScript for the client side validation. If there is an error in the form, a notification appears at the top of the form.

In Internet Explorer 6 through 8, there is a problem in that erroneous JavaScript code is appearing along with the error message. It works seamlessly in all other browsers I have tested.

I have identified the JavaScript code that appears, as a function from one of the plugins used elsewhere on the page.

I can't for the life of me figure out why this is happening, and why it is only happening in IE. I'm hoping someone with more experience can identify the problem.

The page can be found at the following address: http://dev.abito.ca/contact/

The form is on the right hand side of the page. Just click the submit button with nothing in the form in IE 6-8 and you will see the strange code appear.

The JavaScript code that appears is as follows:

function (S, aG) { 
    var K = this.length >>> 0; 
    aG = aG || 0; 
    if (aG < 0) { 
        aG += K 
    } 
    for (; aG < K; ++aG) { 
        if (aG in this && this[aG] === S) { 
            return aG 
        } 
    } 
    return -1 
}

As I mentioned earlier, I have identified the above code as part of the Shadowbox plugin which is found in the plugins.js file, at line 2683 .

Also, the JavaScript for the form validation is found in the script.js file, from line 498-676 .

Thanks for any help you can provide.

It's not easy to test, but I think if you change line 661 of script.js to

for (var x = 0 ; x < data.length ; x++) {

it'll solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM