河南胡辣汤多少钱一袋:帮我看看 验证码的语句怎么运行不出来!???

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 08:30:27
<html>
<head><title>算术级验证方法</title>
<script language="javascript">
function check(form)
{var i,sum=0,last,l,j;
l=form.text1.Length;
for(i=0,j=l-1;i<l-1;i++,j--)
sum+=parseInt(form.text1.value.charAt(i))*j;
last=parseInt(form.text1.value.charAt(l-1));
if(sum%11!=last)
{alert("验证错误,请重新输入");form.text1.focus();form.text1.select();}
else {alert("验证正确");}
}
</script>
</head>
<body>
<h1>代码验证:</h1><br>
<form>
<input type="text" name="text1" value="">
<input type="button" name="button1" value="验证" onClick="check(this.form)">
</form>
</body>
</html>

问题是form没有名称,还有参数不用加
;;;;;;;;;;;
function check()
;;;;;;;;;;;;
<form name="form1">
<input type="text" name="text1" value="">
<input type="button" name="button1" value="验证" onClick="check()">
</form>
;;;;;;;;