好像这样取不到值
下面取到的应该是string吧 还要转 int
if(document.form1.shul.value)<(document.form1.text3.value)
{
alert("输入错误");
return false;
}<form id="form1" name="form1" method="post">
<input name="" type="hidden" name ="shul"value="96" />
<th><input name="text3"; type="text"value="96" /></th>
给你代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="JavaScript">
function aa(){
var a=document.form1.text3.value-document.form1.shul.value;
if(a)
{
alert("输入错误");
return false;
}
}
</script>
</head><body><form id="form1" name="form1" method="post" onSubmit="return aa()">
<input type="hidden" name ="shul"value="96" />
<th><input name="text3" type="text" /></th>
<th><input name="sub" type="submit" value="96" /></th>
</form></body>
</html>
获取的是string,只要不是+的话它会自己转成int。