License Number Validation in JavaScript
<p>I have created a JavaScript function for validation of US Driving License. Issue is function is browser dependent. That is function creates error in IE but run fine in MOZILLA AND CHROME..</p>

<p>I have validated it as first three digit should be either 0 or 1 or 2 or 3.</p>

<pre><code>    //license number
    var strFilter = /^[0-9]*$/;
    var chkVal36 = document.getElementById("license").value;
    var chkVal37 = document.getElementById("license").value.length;
    var chkVal38 = document.getElementById("license").value;

    if ((!strFilter.test(chkVal36)) || ((chkVal36 !== "") &amp;&amp; (chkVal36 === 0)) || (chkVal36 !== "") || (chkVal37 !== 8) || ((chkVal38[0] !== 0) &amp;&amp; (chkVal38[0] !== 1) &amp;&amp; (chkVal38[0] !== 2) &amp;&amp; (chkVal38[0] !== 3))) {
        alert("Please enter valid 8-digit license number\r\n(Only digits)");
        document.getElementById("license").focus();
        document.getElementById("license").style.background = "#DFE32D";
        document.getElementById("license").value = null;
        return false;
    }
</code></pre>
