Why Javascript does not work properly?

I'm working on a web page and try this script, but it does not work (although it works fine in IE). The code is given below:

My function is:

function validateNumber()
        {
            var x=window.event.keyCode;
            //alert(x);
            if(!(x>=48 && x<=57))
                {
                    alert("Please type a number between 0 and 9 !!");
                }
        }

I use it as:

<input type="text" name="cust_age" value=0 size="15" onkeypress="return validateNumber()" style="font-size: 16pt" />

Please let me know how to solve this problem.

Firefox does not use a global event of the window.
On Firefox, you will need to pass the event to the function.

I think it should work (I'm not an expert):

<input type="text" name="cust_age" value=0 size="15" onkeypress="return validateNumber(event)" style="font-size: 16pt" />

function validateNumber(event)
        {
            var x=window.event? window.event.keyCode : event;
            //alert(x);
            if(!(x>=48 && x<=57))
                {
                    alert("Please type a number between 0 and 9 !!");
                }
        }

Tags: Firefox

Similar Questions

  • A Web site requires active javascript but I need to activate javascript. Why javascript does not work?

    Frequently, a website opens and asks that javascript must be enabled.

    I have javascript enabled in my internet options.Why do I keep getting this message?
    

    Java or Javascript? They are totally different. Do you have an example of Web site?

  • JavaScript: does not work properly after update

    Greetings,

    I am currently facing a problem using JavaScript with Firefox. I can load fine JavaScript in the Web site, and it is enabled and everything. In this sense, JavaScript is fine.

    However, when I try to execute a JavaScript script with the 'order', ' javascript: ' in the navigation bar, it no longer works. I can't even do simple things like "javascript: alert ("Hi!"); I would like to know if there is a way to solve this problem. I quite often use this 'feature' to test small scripts.

    Thank you.

    Running javascript: in the navigation bar is disabled for security. Users have been installing malicious software. You can use the new feature called notebook for this instead.

  • my adobe reader software does not work properly always receive a message (not), why?

    my adobe reader software does not work properly always receive a message (not answer), then on the right Circle loading then suddenly stop and then become white background as shown below, why?

    I can't read any pdf file and I try to update the adobe reader and acrobat software, but nothing has changed.

    Untitled.png

    My (certainly old and slow) system made too the first time I opened 11 player, but he "thawed" after fifteen seconds, (an eternity in computing time, I know, but it has finally opened completely) what you see to the right is the "Tools" palette during initialization. That's exactly where mine would freeze at startup. Once he finally opened fully, I clicked on the "Tools" link at the top to close the Panel, and I opened and seen a document in this way and then closed reader. Now when I open the drive, the tool palette is not initialize and it opens immediately.

    Restart and prior to open what any else, open the drive. When you open it, DO NOT try to do anything with it until it fully opens, do not click on anything that it either, do not try to switch to another app give it time to open up completely and then click the tools link to close. Then open and view a document and close it. Close the player and reopen it. the tools Panel should stay closed and reader should open completely immediately.

  • My Acer TravelMate 3273WXMi audio service does not work properly. I use an Audio_Realtek_6.0.1.5413_VistaX86

    Hello
    My Acer TravelMate 3273WXMi audio service does not work properly. I use an Audio_Realtek_6.0.1.5413_VistaX86 on W7 driver. The problem is no outside speaker and not micro.

    2 things:

    -Why you are using Vista drivers with W7? No, there is no specific driver for W7 (search the website of Acer support for your machine).
    -you will never get full nombreauses for help, these drivers.
    See you soon,.
    Jerry
  • HA does not work properly.... subhasis

    Hi all

    I have 7 business esxi 5.0 more and a vc lic. All esx are in single cluster. Today, I noticed that, after the failure of a server esx, vm migrates not this host to another host. Average ha does not work properly. After rephrasing of what esx vms become active but put off the power of the State with the error "failover HA vSphere virtual machine failed. Can someone guide me why it happened?

    Concerning

    Sasmas

    Admission control is enabled. He wouldn't have enough connectors on other hosts for other virtual machines to failover. Disable the admission control and recreate the scenario.

  • My Apple TV remote 3rd generation A1294 doesn't aluminum A1394 does not work properly, the battery is and I have tried all the resets including factory reset.

    My Apple TV remote 3rd generation A1294 aluminium does not work properly, battery is good, and I tried all the resets including factory reset. the battery compartment is clean.

    You don't say what you mean by not working not properly, however...

    Your Apple TV can become affiliated with another remote control. Hold the remote control close to and pointed on the Apple TV, press and hold the menu and rewind buttons together for 6 seconds or until you see an icon of the chain broken on screen.

  • I downloaded Multi Access Tool from Mcafee with Firefox Mozilla, how do I reinstall if it does not work properly?

    I downloaded Multi Access Tool from Mcafee with Firefox Mozilla, how do I reinstall if it does not work properly?

    My sincere apologies, my Mcafee came via the Optimum/Cablevision, not Mozilla. I now managed to solve my problem and appreciate the 2 above responses. Thank you.

  • JavaScript does not work, even if activated in the preferences

    OK, so javascript does not work in my Firefox. I'm going to websites, try to activate some tabs, or similar, and nothing happens. Theres is a new site, which is linked to my University, and when I try to connect I get a message: Javascript must be enabled to use this Web site.
    Thing - it is turned on. I tried to restart (close-> close-> open-> mozilla mozilla activate on-> close mozilla-> open mozilla-> go to the website) but no dice...

    When I try to use IE, everything works, so I have NO idea what to do... Can anyone help?

    Hello

    Please check if this occurs in Safe Mode

    Extensions of the issues

    Troubleshooting Extensions and themes

    Uninstalling the modules

    Uninstalling toolbars

  • Satellite P200 accidents + message: graphic card driver does not work properly

    Hello

    hope that this issue has not been covered before, but I've owned a Satellite P200 for 3 years now, and this week, it crashes all the time.

    When it started going down he gave me a few messages in the sense of "your graphics card/driver does not work properly and windows will be arrested to avoid damage.

    It has progressed to the point where now when I turn it on, I have vertical lines running down the screen and the screen flashes on and outside. Within 20 seconds, it restores the BSOD - 'there was a problem and windows will be arrested. Error Page_Fault_In_Non_Paged_Area"then stops.

    I ran a system restore but the problem remains.

    I have a feeling that my graphics card is toast. Is this good? Are there any other options to try? Thanks in advance for any answers.

    Matt

    Hello

    Sounds like the GPU problem.
    But try the graphics card driver update.
    Use the most recent driver for your graphics card.

    In addition, clean the fans of portable computers.
    Dust and debris could prevent the cooling fans to turn with the best speed and this could lead to a higher temperature which would lead to overheating.
    Use a jet of compressed air. I also use it and it helps to get rid of dust and debris.

    If this is not enough, then a problem of graphics chip would be possible.

  • Satellite L775 - mouse pad does not work properly

    I have a laptop Toshiba Satellite L775. I run Win 7 Home Premium. My mouse pad does not work properly. I also have a Logitech Anywhere MX wireless mouse. I tried the mouse pad to work properly with the key FN and F9, but it does not work. And you really have no idea if that turns or out of the mousepad anyway, subj for another time I guess.

    What does not work, but I have to do is to go to Control Panel then mouse option load that and just scroll the tabs without changing what each time and then close and the touch pad works. But only for this session. If I have my laptop nearby, or turn it off, I have to start throughout the whole process.

    What's past and how to fix this?

    Thank you very much.

    > What's past and how to fix this?
    After reading your ad, I still don t know what is your problem.
    > My mouse pad is not working properly
    How to understand this? What does not work properly? What happen exactly when you start your laptop?

  • Satellite Pro M10 - infrared does not work properly

    Hello

    I have a Satellite Pro M10 and my infrared does not work. I downloaded the zip file with the drivers from this site. Then, I uninstalled and reinstalled, but it always happens in the Device Manager under "unknown - SMC IrCC - Fast Port infrared (IR Module: HP). (with an exclamation point). When I look at the properties it says under device status:

    This device does not work properly because Windows cannot load the drivers required for this device. (Code 31)

    Click Troubleshoot to start the troubleshooter for this device.

    However, under Driver Details is said:
    C:\windows\system32\DRIVERS\smcirda.sys

    I extracted the zip file in my home directory of c:\downloads\infrared.
    whatever I do, it does not now. It worked when I bought it, but I have too many things on the system for a new installation. Which brings me to another question. Is it possible to re - install windows without losing all your data, etc.? I did it with other systems (95,98) Windows. But it seems that the Toshiba recovery disc means any wiping.

    Thanks in advance for any help.
    Chris

    Hello

    If your HARD disk contains two partitions and you have saved the data on a second you can reinstall the operating system on the first partition using recovery DVDs.

  • Mat * one years (uj-840) DVD player does not work properly

    The Mat * one years (uj-840) DVD player does not work properly.
    A symptom of the problem is that the icon does not appear in 'my computer '.
    more and she does not recognize the CD.

    I went to the properties of the drive through Device Manager and saw the following message is displayed:

    "Windows cannot load the driver for this hardware device. The driver may be corrupted or missing. (Code 39)
    Click Troubleshoot to start the troubleshooter for this device. »

    Following the instruction of the troubleshooter, I tried to update my driver through
    Device Manager, but it tells me that the current driver is the more up-to-date version.
    In the properties of the drive, I found that my driver version is: 5.1.2535.0

    What is a simple problem that has a solution?
    I don't see other actions to find the root of the problem.

    Thank you

    I hope this article can help you - http://aps2.toshiba-tro.de/kb0/FAQ8101LA0000R01.htm
    Check it out!

  • Toshiba common modules does not work properly

    Whenever I connect to the laptop, I get a message: Tfncky: Toshiba common modules does not work properly.

    Anyone know what this means?
    I wonder if that has something to do with my windows media player does not properly. If I open the application, it is not to maximize the screen shows the taskbar
    Finally, it simply says "not responding" and I have to close the application. Tried to remove and reload that a new copy of WMP but it does not help.

    I don't know what laptop mode you but the first thing to do is to reinstall the Toshiba common modules.
    Please visit Toshiba support and download page under http://eu.computers.toshiba-europe.com go to the download section, choose your phone model and download common modules.

    Please let us know if everything works well again.

  • Keyboard does not work properly

    Hello

    I had trouble getting my laptop satellite to initialize. Recovery disks & pressing F keys weren't working so I decided to open the laptop to see if there are any loose connections. To my surprise, the laptop seems to work again once I had the USB keys and put back them in! Unfortunately, before that I did, I opened the keyboard and peeked inside.

    When I booted up and tried to use the keyboard keys half of their work and the other half seem to think that they represent two other keys for example if I type the letter 'E' I get '3' and '-' as a whole. After 5-10 minutes the entire keyboard will become totally unresponsive until I restart again. Of course, I think I've done something here because this problem since I opened the bottom of the keyboard. This could be a hardware failure I have caused or is anyway that this issue can be resolved without replacing anything?

    Thank you very much

    Tom

    Hi Tom

    Theoretically, it might be just a connection lost between the keyboard and the motherboard, but I'm afraid, it can be a serious problem of m.
    Maybe you have damaged the connector of the keyboard cable or something similar, and not the keyboard does not work properly.

    I think the keyboard needs to be replaced to check if only this part is affected

Maybe you are looking for