<script language="JavaScript">
function checkForm(var age)
{
var a = toInt(age);
return age>=1&&age<=99;
}
</script><form name="form" onSubmit="return checkForm(document.form.age.value)">
<input type="text" name="age" maxLength="2"/>
</form>用HTML就可以完成,和JSP无关。
function checkForm(var age)
{
var a = toInt(age);
return age>=1&&age<=99;
}
</script><form name="form" onSubmit="return checkForm(document.form.age.value)">
<input type="text" name="age" maxLength="2"/>
</form>用HTML就可以完成,和JSP无关。
<script language="JavaScript">
function checkForm()
{
if(document.form.age.value>=1&&document.form.age.value<=100){return ture;}
else {alert("请输入正确的年龄");return false;} }
</script><form name="form" onSubmit="return checkForm()">
<input type="text" name="age" maxLength="2"/>
</form>
{
alert("错误");
}