js一个小调用问题

YiNuoHuaZhuangP 2013-03-11 11:12:16
现在按钮调用的是判断的js 我想判断结果都符合后 提交按钮变成灰色 就是只能点一次的


我想把第二个代码 放到第一个代码里

这是判断的js和按钮
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkuserinfo()
{
if(checkspace(document.userinfo.dingdanhao.value)) {
document.userinfo.dingdanhao.focus();
alert("请认真填写订单号!");
return false;
}

if(checkspace(document.userinfo.dianpu.value)) {
document.userinfo.dianpu.focus();
alert("请认真填写店铺名称!");
return false;
}
if(checkspace(document.userinfo.wangwang.value)) {
document.userinfo.wangwang.focus();
alert("请认真填写会员号!");
return false;
}
if(checkspace(document.userinfo.shouhuoname.value)) {
document.userinfo.shouhuoname.focus();
alert("请认真填写收货人姓名!");
return false;
}
if(checkspace(document.userinfo.tel.value)) {
document.userinfo.tel.focus();
alert("请认真填写电话!");
return false;
}
if(checkspace(document.userinfo.address.value)) {
document.userinfo.address.focus();
alert("请认真填写地址!");
return false;
}
if(checkspace(document.userinfo.zhifu.value)) {
document.userinfo.zhifu.focus();
alert("请认真填写支付方式!");
return false;
}
if(checkspace(document.userinfo.shangpin.value)) {
document.userinfo.shangpin.focus();
alert("请认真填写主商品!");
return false;
}


//if(checkspace(document.userinfo.wuliu.value)) {
// document.userinfo.wuliu.focus();
// alert("请认真填写物流!");
// return false;
// }
//
//
// if(checkspace(document.userinfo.danhao.value)) {
// document.userinfo.danhao.focus();
// alert("请认真填写物流单号!");
// return false;
// }

if(checkspace(document.userinfo.zongjia.value)) {
document.userinfo.zongjia.focus();
alert("请认真填写总价!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</script>

<input type="submit" name="Submit" value="提交" onClick="return checkuserinfo();">


这是提交按钮变灰的js和按钮
<script language="javascript">
function my_submit(){
document.form1.submit();
document.form1.submit1.disabled=true;
}
</script>

<input type="submit" onClick="javascript:my_submit();" name="submit1" value=" 导 入 " class="Inputbtn">
...全文
149 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
    function checkuserinfo() {
        if (checkspace(document.userinfo.dingdanhao.value)) {
            document.userinfo.dingdanhao.focus();
            alert("请认真填写订单号!");
            return false;
        }

        if (checkspace(document.userinfo.dianpu.value)) {
            document.userinfo.dianpu.focus();
            alert("请认真填写店铺名称!");
            return false;
        }
        if (checkspace(document.userinfo.wangwang.value)) {
            document.userinfo.wangwang.focus();
            alert("请认真填写会员号!");
            return false;
        }
        if (checkspace(document.userinfo.shouhuoname.value)) {
            document.userinfo.shouhuoname.focus();
            alert("请认真填写收货人姓名!");
            return false;
        }
        if (checkspace(document.userinfo.tel.value)) {
            document.userinfo.tel.focus();
            alert("请认真填写电话!");
            return false;
        }
        if (checkspace(document.userinfo.address.value)) {
            document.userinfo.address.focus();
            alert("请认真填写地址!");
            return false;
        }
        if (checkspace(document.userinfo.zhifu.value)) {
            document.userinfo.zhifu.focus();
            alert("请认真填写支付方式!");
            return false;
        }
        if (checkspace(document.userinfo.shangpin.value)) {
            document.userinfo.shangpin.focus();
            alert("请认真填写主商品!");
            return false;
        }


        //if(checkspace(document.userinfo.wuliu.value)) {
        //    document.userinfo.wuliu.focus();
        //    alert("请认真填写物流!");
        //    return false;
        //  }
        //  
        //  
        //  if(checkspace(document.userinfo.danhao.value)) {
        //    document.userinfo.danhao.focus();
        //    alert("请认真填写物流单号!");
        //    return false;
        //  }

        if (checkspace(document.userinfo.zongjia.value)) {
            document.userinfo.zongjia.focus();
            alert("请认真填写总价!");
            return false;
        }
        //========================================
        setTimeout(function () { document.userinfo.Submit.disabled = true; }, 100);//
        //========================================
    }
    function checkspace(checkstr) {
        var str = '';
        for (i = 0; i < checkstr.length; i++) {
            str = str + ' ';
        }
        return (str == checkstr);
    }
bsk_bg 2013-03-12
  • 打赏
  • 举报
回复
function my_submit(){     document.form1.submit();     document.form1.submit1.disabled=true; } 
把这个跟上面的、
function checkspace(checkstr) {   var str = '';   for(i = 0; i < checkstr.length; i++) {     str = str + ' ';   }   return (str == checkstr); } 
放到这个后面不行吗

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧