473,503 Members | 4,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Firefox and IE cursor key codes different?

Hi

I'm pretty new to javascript and cross-browser stuff.

I want to restrict text input boxes to only numbers and decimal points
and exclude all else....except cursor keys, home keys etc.

I've managed to do this by handling the keyCode in the keypress event,
but the same code on IE allows cursor keys to be used, but firefox
doesn't.

Is there a difference in how I should handle both browsers?

Regards,
Mark

Nov 15 '06 #1
2 2225
Lee
mm*******@yahoo.co.uk said:
>
Hi

I'm pretty new to javascript and cross-browser stuff.

I want to restrict text input boxes to only numbers and decimal points
and exclude all else....except cursor keys, home keys etc.
Bad idea. As you've found, you can't be sure you've handled all
browsers correctly. You're likely to frustrate your users and
you gain nothing by it. Use an onChange event to audit the value
entered by the user to make sure it only contains valid characters.

Consider the person who sometimes hits the wrong key while typing,
but realizes it and hits the backspace, then the correct key, and
then continues typing (as I've managed to do three times in this
sentence). If you had blocked that incorrect key, their backspace
would have deleted the previous, correct, character, instead, and
they might not notice that. Input filtering causes input errors.

Or did you forget to allow backspace?
--

Nov 15 '06 #2
I appreciate what you're saying, but I really do want to restrict the
input text control to numerics.

Backspace seems to work, it's just cursor keys.

Regards,
Mark

Nov 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2943
by: niconedz | last post by:
Hi The following code works fine in IE but not Firefox. It's a little script that zooms an image and resizes the window to fit. Can anybody tell me what's wrong? Thanks Nico == btw.....
10
67730
by: Eric-Sebastien Lachance | last post by:
Hey there, I decided to just create a 100% height and width div that filled the space over a background header image, and add an onclick event to redirect to the my index... Doesn't seem to work...
1
2575
by: Jordan | last post by:
I set the cursor property to change to the "hand" when the user performs an "onmouseover" event on a hyperlink object. This does work correctly with Internet Explorer, however, with Netscape and...
5
3495
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything...
4
2640
by: the other john | last post by:
I came across a third party script I want to learn how to configure as well as learn more dhtml in the doing. I'm not much of a JS guy yet but I'm working on it. This script works fine in IE6...
37
2368
by: Laphan | last post by:
Hi All Two of my friends have Firefox installed with FireBug, which I believe is an extension to test markup, and have found oddles of errors in my CSS even though Firefox and IE display the...
3
6812
by: atn2002 | last post by:
I'm trying to create a control which when the mouse button gets pressed on one div an absolute positioned div pops up in place of the cursor. From there the cursor should interact with the dialog...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5598
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1522
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.