document.getElementById('rowtxtConsidAmt') null only in mozilla
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" />
(Rs.) <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
.
精彩评论