473,657 Members | 2,380 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 2231
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
2953
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.. sorry for the long post ==
10
67749
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 in FireFox only, just in IE. Here's the code: <div id="headerimg"><div style="width: 100%; height: 100%; cursor: hand; cursor: pointer;" onclick="top.location.href('http://www.monamouchtim.com/');">&nbsp;</div></div>
1
2589
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 Firefox, the cursor is just the "vertical line." Does anyone know why this isn't working with Netscape or Firefox? Thanks!
5
3507
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 works fine as it also does in firefox if I call the contents frame directly (i.e. outside of its frameset). However, if I call my main page (index.html) which invokes the frame set, the contents frame javascript menubar onmouseover function...
4
2655
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 but is a dead fish in FireFox. There is no support offered on the site where it came from. I'd really appreciate help with this as it will not only to get it working but to learn how it all works so I can add it to my repertoire. Thanks!
37
2396
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 pages without problems. Has anybody used and had problems with this Firebug? It keeps saying that my cursor:hand command is invalid. I thought this was standard CSS2?
3
6840
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 before the mouse button is released. In other words one element will catch onmousedown, display the popup, and the popup element will catch onmouseup. This works fine in IE as the popup automatically accepts following events, but my problem is...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.