Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.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 Google Chrome问题:没有表单提交,其代码会禁用提交按钮_Javascript_Jquery_Html_Google Chrome - Fatal编程技术网

Javascript Google Chrome问题:没有表单提交,其代码会禁用提交按钮

Javascript Google Chrome问题:没有表单提交,其代码会禁用提交按钮,javascript,jquery,html,google-chrome,Javascript,Jquery,Html,Google Chrome,单击“提交”按钮后,我想禁用它。这是我的提交按钮代码: <button title="<?PHP echo getTranslatedString('LBL_SAVE_ALT'); ?>" accessKey="S" class="btn btn-primary" value="<?PHP echo getTranslatedString('LBL_SAVE_LAPTOP'); ?>" id="formSave" type="submit" name="button

单击“提交”按钮后,我想禁用它。这是我的提交按钮代码:

<button title="<?PHP echo getTranslatedString('LBL_SAVE_ALT'); ?>" accessKey="S" class="btn btn-primary" value="<?PHP echo getTranslatedString('LBL_SAVE_LAPTOP'); ?>" id="formSave" type="submit" name="button" onclick="return checkform();">
    Save detail
</button>

当我在
Mozilla Firefox
中提交表单时,它可以工作,但在
Google Chrome
中它不工作(它只禁用按钮;它不发送表单提交)。

您发布的代码没有禁用提交按钮-它禁用了id为
idproof
的东西-不知道这是什么。开发者工具控制台中有错误吗?firefox中没有sir,它禁用按钮并提交表单,但相同的代码不适用于cromei解决我的问题使用css禁用按钮解决点击问题,只需确保你也“模糊”按钮(与焦点相反,而不是图形效果)-因为键盘上的
空格
回车
仍会触发该按钮,如果它有焦点!!
function checkform() {
    var incvfr=$("#invoice").val();
    var inseridf=$("#invserial").val();
    if (incvfr== 1) {
        if (inseridf=='') {
            alert("Please enter invoice number");
            return false;
        }
    }
    var name=$("#name").val();
    var mobile=$("#mobile").val();
    var email=$("#email").val();
    var switchs=$("#switch").val();
    var brand=$("#brand").val();
    var processor=$("#processor").val();
    var ram=$("#ram").val();
    var hdd=$("#hdd").val();
    var color=$("#color").val();
    var broken=$("#broken").val();
    var os=$("#os").val();
    var battery=$("#battery").val();
    var adapter=$("#adapter").val();
    var phycond=$("#phycond").val();
    var lpserial=$("#lpserial").val();
    var lpdoc=$("#lpdoc").val();
    var idproof=$("#idproof").val();
    if (name!='' && mobile!='' && email!='' && switchs!='' && brand!=''
            && processor!='' && ram!='' && hdd!='' && color!='' && broken!='' 
                && os!='' && battery!='' && adapter!='' && phycond!='' && lpserial!='' 
                    && lpdoc!='' && incvfr!='' && idproof!='') {
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].disabled = true;
        }
        document.getElementById("idproof").disabled = true;
    }
    else {
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].disabled = false;
        }
        document.getElementById("idproof").disabled = false;
    }
    //document.getElementById("formSave").disabled = true;
}