喜 我想两个检查两个字段 如果两个字段的值相同,则其显示一个消息二我,我有一个代码,但检查两个表单字段
它不工作,你能告诉我什么拨错这个代码
<script type="text/javascript">
function checkForm(form1){
if(form1.field1.value == form1.field2.value){
alert(" values are identical");
form1.field1.focus();
return true;
}else{
return false;
}
}
</script>
<form name="form1" method="POST" action="" >
<input type="text" name="field1">
<input type="text" name="field2">
<input type="submit" onClick="return checkform1(this);" >
</form>
对于初学者来说,你打电话'checkform1'和你的功能被命名为'checkForm'。 – zdyn 2011-02-28 06:22:05