Html代码:
<form action="order_add_data.php" method="post" name="order_adds"> .......... <input type="submit" class="submit" id='fk_submit' value="提交添加" size="10" onclick="return check_input();"/> </form>
js代码:成功提交后将 submit 置为不可用阙状态。
注:引入了jquery
function check_input (){ var order_num=$("#order_num").val(); var dinghuo=$("#dinghuo").val(); var dinghuo_tel=$("#dinghuo_tel").val(); var shouhuo=$("#shouhuo").val(); var shouhuo_tel=$("#shouhuo_tel").val(); var songhuo_addr=$("#songhuo_addr").val(); var shangpin=$("#shangpin").val(); var shuliang=$("#shuliang").val(); if (order_num==""||dinghuo==""||dinghuo_tel==""||shouhuo==""||shouhuo_tel==""||songhuo_addr==""||shangpin==""||shuliang=="") { alert("带*不能为空!"); return false; }else{
//验证通过后:执行如下代码 document.order_adds.submit(); $("#fk_submit").attr('disabled',true); return false; }