Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaScript仅在Chrome中工作_Javascript_Internet Explorer_Google Chrome_Firefox - Fatal编程技术网

JavaScript仅在Chrome中工作

JavaScript仅在Chrome中工作,javascript,internet-explorer,google-chrome,firefox,Javascript,Internet Explorer,Google Chrome,Firefox,字段验证后,下面的代码不会返回上一页的任何值。但这段代码只在Chrome中有效。Firefox和IE不起作用 function quickenquiryValidator() { // Make quick references to our fields var regex = /^[a-zA-Z ]{2,30}$/; var qename = document.getElementById('qename'); var qemobile = document.

字段验证后,下面的代码不会返回上一页的任何值。但这段代码只在Chrome中有效。Firefox和IE不起作用

function quickenquiryValidator() {
    // Make quick references to our fields
    var regex = /^[a-zA-Z ]{2,30}$/;
    var qename = document.getElementById('qename');
    var qemobile = document.getElementById('qemobile');
    var qeemail = document.getElementById('qeemail');
    var calculation = document.getElementById('BotBootInput_Enquiry').value;
    // Check each input in the order that it appears in the form!
    //if(isAlphabet(qename, "Please enter only letters for your name")){
    if (regex.test(qename.value)) {
        if (isNumeric(qemobile, "Please enter a valid mobile number")) {
            if (emailValidator(qeemail, "Please enter a valid email address")) {
                if (check_calculation(calculation, "Please enter valid calculation result")) {
                    document.getElementById("submit4").setAttribute("type", "submit");
                    document.quickenqform.submit();
                    return true;
                }
            }
        }
    }
    else {
        alert("Please enter only letters for your name");
        qename.focus();
        return false;
    }
    return false;
}

控制台中有错误吗?控制台中没有错误。好吧,if语句中有一些分支,在条件未满足时不会返回任何结果。有没有可能,其中一个分支执行了?你能用fiddle来定位这个问题吗?我试过了,但没有成功。