Check two form fields
<p>hi
i want two check two fields 
if the value of two fields is same then its shows a message two me i have a code but</p>

<p>its not working can you tell me what worng with this code</p>

<pre><code>&lt;script type="text/javascript"&gt;
function checkForm(form1){
    if(form1.field1.value == form1.field2.value ){
        alert(" values are identical");
        form1.field1.focus();
        return true;
    }else{
        return false;
    }
}
&lt;/script&gt;
&lt;form name="form1" method="POST" action="" &gt;
&lt;input type="text" name="field1"&gt;
&lt;input type="text" name="field2"&gt;
&lt;input type="submit" onClick="return checkform1(this);" &gt;
&lt;/form&gt;
</code></pre>
