开发者

document.getElementById('rowtxtConsidAmt') null only in mozilla

开发者 https://www.devze.com 2023-03-10 23:11 出处:网络
I am gettig the above error in mozila , but its works well in IE Javascript: function ValidateForm() {

I am gettig the above error in mozila , but its works well in IE

Javascript:

function ValidateForm() { 

    var objtxtStampDutyAmt= document.getElementById(contentPlaceholderId + 'txtStampDutyAmt');
     if( objtxtStampDutyAmt != null && document.getElementById('rowtxtStampDutyAmt').style.display != 'none' )
     {
        if(trim(objtxtStampDutyAmt.value) == '')
        { 
            alert("Please enter Stamp Duty Amount");
            objtxtStampDutyAmt.focus(); 
            return false;
        }
     }
}

ASPX:

  <tr id="rowTxtConsidAmt">
        <td class="formlabel">
            <asp:Label ID="lblConsidA开发者_运维问答mt" runat="server" Text="Consideration Amount" />
            &nbsp; (Rs.)&nbsp;<font class="textMandatory">*</font>
        </td>
   </tr>

Call is here:

<td colspan="6" class="formgrouptitle">
                            <asp:Button ID="btnPayment" runat="server" Text="Click here to make payment" CssClass="Button"
                                OnClick="btnPayment_Click" OnClientClick="return ValidateForm()" />
                        </td>

How to solve this?


According to the IE documentation getElementById is case-insensitive for versions less than 8. According to the Firefox documentation getElementById is case-sensitive. So you need to verify that your casing is the same between the HTML and what you pass to getElementById.

0

精彩评论

暂无评论...
验证码 换一张
取 消