Onkeydown event in javascript not working in firefox3.0
-
hi, The following code is not working in firefox3.0 but it's working fine in firefox2.0 what's the prb? any one plz help me..... <asp:TextBox ID="txtBirthdate" CssClass="date_box" runat="server" TabIndex="3" onkeydown="OnTextChange('ctl00$ContentPlaceHolder1$btnSubmit');" onchange="OnTextChange('ctl00$ContentPlaceHolder1$btnSubmit');"></asp:TextBox> <asp:Button ID="btnSubmit" Enabled="false" runat="server" CssClass="button" Text="Save" TabIndex="16" ValidationGroup="ValPatient_Detail" OnClick="btnSubmit_Click" /> function OnTextChange(Button) { if(navigator.appName!="Netscape") { document.getElementById(Button).disabled=false; } else { document.getElementById(Button).disabled=false; } } Button-->> value is btnSubmit
-
hi, The following code is not working in firefox3.0 but it's working fine in firefox2.0 what's the prb? any one plz help me..... <asp:TextBox ID="txtBirthdate" CssClass="date_box" runat="server" TabIndex="3" onkeydown="OnTextChange('ctl00$ContentPlaceHolder1$btnSubmit');" onchange="OnTextChange('ctl00$ContentPlaceHolder1$btnSubmit');"></asp:TextBox> <asp:Button ID="btnSubmit" Enabled="false" runat="server" CssClass="button" Text="Save" TabIndex="16" ValidationGroup="ValPatient_Detail" OnClick="btnSubmit_Click" /> function OnTextChange(Button) { if(navigator.appName!="Netscape") { document.getElementById(Button).disabled=false; } else { document.getElementById(Button).disabled=false; } } Button-->> value is btnSubmit
Far as I'm concerned, using the
document.getElementById
function requires the ClientId as parameter, and not the name. ctl00$ContentPlaceHolder1$btnSubmit looks more like a name, the Id would probably be ctl00_ContentPlaceHolder1_btnSubmit. To avoid confusion (and really, not try to guess what a ClientId is going to be I would use:[...]
onkeydown="OnTextChange('<%=btnSubmit.ClientID%>')"
[...]var question = (_2b || !(_2b));