<!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" type="text/javascript">
function MaxValue()
{
//var str ="6";
//var str=document.getElementByname(str).value.trim();
// var str=document.getElementByname(str).value;
var num=document.getElementById("num").value;
if(num.length!=0){
if(num<"6" && num>"0")
{
alert("ok");
return true;
}
else{
alert("对不起,您借阅图书不能超过5本");//请将“数字”改成你要验证的那个属性名称!
return false;
}
}
else{
alert("输入的数字不能为空!");
return false;
}
}
</script>
</head>
<body>
<form action="2.html "name="form1" method="post" οnsubmit="return MaxValue()">
<input type="text" name="number" size="6" id="num"/> 本<br/><br/>
<input type="submit" value="确认"> <input type="reset" value="重置">
</form>
</body>
</html>