Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Javascript does not work with firefox browser?

Javascript does not work with firefox browser?

Scheduled Pinned Locked Moved ASP.NET
helpjavascriptsysadmintoolsarchitecture
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mdrizwan_1
    wrote on last edited by
    #1

    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>

    A P 2 Replies Last reply
    0
    • M mdrizwan_1

      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>

      A Offline
      A Offline
      ais07
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • M mdrizwan_1

        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>

        P Offline
        P Offline
        Palash Biswas
        wrote on last edited by
        #3

        use the bellow code..

        if (window.event) // eg. IE
        {
        keyASCII = window.event.keyCode;

            }
            else if (event.which) // eg. Firefox
            {
                keyASCII = event.which;
            }
        
        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups