Javascript does not work with firefox browser?
-
Hello, I have following javascript below it works fine with IE explorer when i try to insert special characters in textbox it does not except it. But when i run this in firefox it does not have any effect it excepts special characters in texbox.Can anybody solve this problem it will be a great help? Thanks in Advance.
<script language="JavaScript" type="text/javascript"> function NumberOnly() { var keyASCII = window.event.keyCode; var keyValue = String.fromCharCode(keyASCII); if (!(keyASCII >= '97' && keyASCII <= '122') && !(keyASCII >= '65' && keyASCII <= '91') && !(keyValue >= '0' && keyValue <= '9')) { window.event.keyCode = 0; } } </script>``<asp:TextBox ID="txtbName" onkeypress = "NumberOnly()" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#CCCCCC" BackColor="White" Width="150px" CausesValidation="True" Height="20px" MaxLength="50"></asp:TextBox>
-
Hello, I have following javascript below it works fine with IE explorer when i try to insert special characters in textbox it does not except it. But when i run this in firefox it does not have any effect it excepts special characters in texbox.Can anybody solve this problem it will be a great help? Thanks in Advance.
<script language="JavaScript" type="text/javascript"> function NumberOnly() { var keyASCII = window.event.keyCode; var keyValue = String.fromCharCode(keyASCII); if (!(keyASCII >= '97' && keyASCII <= '122') && !(keyASCII >= '65' && keyASCII <= '91') && !(keyValue >= '0' && keyValue <= '9')) { window.event.keyCode = 0; } } </script>``<asp:TextBox ID="txtbName" onkeypress = "NumberOnly()" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#CCCCCC" BackColor="White" Width="150px" CausesValidation="True" Height="20px" MaxLength="50"></asp:TextBox>
http://www.google.com/search?hl=en&q=keycode+javascript+firefox+%26+IE&aq=f&oq=&aqi
Life Is Beautiful
modified on Saturday, February 20, 2010 6:32 AM
-
Hello, I have following javascript below it works fine with IE explorer when i try to insert special characters in textbox it does not except it. But when i run this in firefox it does not have any effect it excepts special characters in texbox.Can anybody solve this problem it will be a great help? Thanks in Advance.
<script language="JavaScript" type="text/javascript"> function NumberOnly() { var keyASCII = window.event.keyCode; var keyValue = String.fromCharCode(keyASCII); if (!(keyASCII >= '97' && keyASCII <= '122') && !(keyASCII >= '65' && keyASCII <= '91') && !(keyValue >= '0' && keyValue <= '9')) { window.event.keyCode = 0; } } </script>``<asp:TextBox ID="txtbName" onkeypress = "NumberOnly()" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="#CCCCCC" BackColor="White" Width="150px" CausesValidation="True" Height="20px" MaxLength="50"></asp:TextBox>
use the bellow code..
if (window.event) // eg. IE
{
keyASCII = window.event.keyCode;} else if (event.which) // eg. Firefox { keyASCII = event.which; }