facing comparision issue in javascript
<p>this is what is my java script function : </p>

<pre><code>function issueOrReturn() {
    var functiontype = document.getElementById("functiontype").value;
    alert("functiontype : "+functiontype);
    if (functiontype=="issueTempcard") {
        alert("1111111111111111111111111");
        var empid = document.getElementById("empid").value;
        var tempcardnumber = document.getElementById("tempcardnumber").value;
        var dateofissue = document.getElementById("dateofissue").value;
        if(empid.length==0) {
            alert("Please enter Employee ID ");
            return false;
        }
        if(tempcardnumber.length==0) {
            alert("Please enter Card Number ");
            return false;
        }
        if(dateofissue.length==0) {
            alert("Please enter Date of issue ");
            return false;
        }
        if(empid.length &gt; 0 &amp;&amp; tempcardnumber.length &gt; 0 &amp;&amp; dateofissue.length &gt; 0) {
            document.forms["frmTempcard"].submit();
        } else {
            alert("Please enter Employee ID and and Card Number and Date of issue ");
            return false;
        }
    }
    if (functiontype == "returnTempCard") {
        alert("222222222222222222222222222222");
        var empid = document.getElementById("empid").value;
        var dateofreturn = document.getElementById("dateofreturn").value;

        if (empid.length == 0) {
            alert("Please enter Employee ID ");
            return false;
        }
        if (dateofreturn.length == 0) {
            alert("Please enter Date of return ");
            return false;
        }
        if (empid.length &gt; 0 &amp;&amp; dateofreturn.length &gt; 0) {
            document.forms["frmTempcard"].submit(); 
        } else {
            alert("Please enter Employee ID and Date of return ");
            return false;
        }
    }
}
</code></pre>

<p>here the functiontype is : <code>issueTempcard</code> the alert is printed but it is not getting in the if loop of <code>issueTempcard</code> hence the form is not submitted,</p>

<p>also please advise me whether the following way is correct to submit the form : </p>

<pre><code>if (empid.length &gt; 0 &amp;&amp; tempcardnumber.length &gt; 0 &amp;&amp; dateofissue.length &gt; 0) {
    document.forms["frmTempcard"].submit(); 
} else {
    alert("Please enter Employee ID and and Card Number and Date of issue ");
}
</code></pre>

<p>kindly provide me some help so that i can do it.</p>

<p>Regards,</p>
