手记

〇〇九章 input标签onsubmit选择阻止回车键提交表单

<form name="form1" method="post" onsubmit=“return get();" action=" "/>
<input type="radio" name ="fruit" onBlur="get()" value="0" checked>否
<input type="radio" name ="fruit" onBlur="get()" value="1">是
<input name="a9" type="text" id="q" size="10" value="daxia">
<input name="a9" type="text" id="a" size="10" value="daxia">
</form>
<script type="text/javascript">
function get(){
var obj = document.getElementsByName("fruit");
for(var i=0; i<obj.length; i ++){
if(obj[i].checked){if((obj[i].value)==0){
return false;
}else{ return true;
}
}
}
}
</script>
//注意onsubmit=“return get();" 非onsubmit=“get();"

0人推荐
随时随地看视频
慕课网APP