日期:2014-05-16  浏览次数:20364 次

提交表单,判断拦截的代码
html部分
<form   action= "/login.asp "   method= "post "   name= "login "   onsubmit= "formSubmit(this) ">

<p> <label   for= "name "> 账户 </label> <input   name= "nickname "   type= "text "   id= "name "   /> </p>
<p> <label   for= "psd "> 密钥 </label> <input   name= "psd "   type= "password "   id= "psd "   /> <a   href= "# "> 忘记密码? </a> </p>
<p> <label   for= "psd "> 验证 </label> <input   name= "yz "   type= "text "   id= "psd "   /> <%Call   GetSafeCode%> </p>
<p   class= "p3 "> <input   name= " "   type= "button "   class= "submit "   value= "登录 "   /> </p>

</form>
---------------------
要求,任何一个文本框都不能为空!   如果都填写了则提交表单

写函数formSubmit()

------解决方案--------------------
formSubmit(obj)
{
var objar=obj.getElementsByTagName( "input ");
for(var i=0;i < objar.length;i++)
{
if(objar[i].value== " ")return;
}
obj.submit();
}