喜 我想兩個檢查兩個字段 如果兩個字段的值相同,則其顯示一個消息二我,我有一個代碼,但檢查兩個表單字段
它不工作,你能告訴我什麼撥錯這個代碼
<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