①限制输入长度
<script>
function test()
{
if(document.控件名称.value.length>66)
{
alert("输入个数不能超过66个字符!");
document.控件名称.focus();
return false;
}
}
</script>
②判断两次输入密码是否相同
<script>
function check()
{
with(document.all){
if(input1.value!=input2.value)
{
alert("false")
input1.value = "";
input2.value = "";
}
else document.forms[0].submit();
}
}
</script>
控件如下:
<input type="password" id="input1">
<input type="password" id="input2">
<input type="button" value="test" onclick="check()">