Java Script: onsubmit="check_rfields();" in form tag of html. But getting failed in validation
<p>onsubmit="check_rfields();" in form tag of html. But getting failed in validation.</p>

<pre class="lang-js prettyprint-override"><code>function check_rfields() { 

    var name = document.getElementById("id_rname").value;

    var email = document.getElementById("id_remail").value;

    var cemail = document.getElementById("id_rcemail").value;

    var password = document.getElementById("id_rpassword").value;

    var cpassword = document.getElementById("id_rcpassword").value;

    if(name=='' || name==0 

        &amp;&amp; email=='' ||  email==0 

        &amp;&amp; cemail=='' || cemail ==0 

        &amp;&amp; password=='' || password==0 

        &amp;&amp; cpassword=='' || cpassword==0 ) {

        document.getElementById("onsubmitErr").innerHTML 
                                                    = "All fields arerequired"; 

                return false;   
          }

    return true;
}
</code></pre>
