473,322 Members | 1,232 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Problem capturing return key (keycode = 13) in Firefox

Hi,

I have a small JavaScript code in a page to trap when user presses Return key.

My problem is that if you visit the page and then enter a different url in address field, and press Return, that key press is also being captured. How can I distinguish when user is pressing Return on the address field in address bar?

Works ok on IE, the problem appears only in Firefox.

This is the code I have:

Expand|Select|Wrap|Line Numbers
  1. document.onkeyup = HandleKeyup;
  2.  
  3. function HandleKeyup(e){
  4.    if(!e){
  5.      e = window.event;
  6.  }
  7.  if(e.keyCode == 13){
  8.     SomeFunction();
  9.  }
  10. }
Thanks!
Veronica
Dec 5 '06 #1
2 8996
pshm
20
Expand|Select|Wrap|Line Numbers
  1. document.onkeyup = HandleKeyup;
  2.  
  3. function HandleKeyup(e){
  4.    if(!e){
  5.      e = window.event;
  6.  }
  7.  if(e.which == 13){
  8.     SomeFunction();
  9.  }
  10. }
  11.  
Mar 27 '08 #2
mrhoo
428 256MB
The address bar is not in the document, so I'm not sure how IE is capturing it, either.
Mar 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
6
by: Robert Nurse | last post by:
Hi, Is it at all possible to capture and suppress the backspace key when focus is not on a form edit control? Basically, while the page is loading I don't want the user pressing the backspace...
3
by: coolsti | last post by:
Can someone help me enhance this code snippet which works only for IE so that it will also work for Firefox? I have been trying all sorts of things and have gotten to where I can capture the...
7
by: jerrygarciuh | last post by:
Hello, I have been playing with various Googled solutions for capturing the <Enter> key to suppress form submission. My first question is whether anyone has a script that works in all common...
6
by: rich_poppleton | last post by:
Help.... I've got a textarea where people type in a description. However for certain reasons we need to stop them typing !$*^ . I have a solution this which works fine in IE: function...
3
by: Muriel | last post by:
I'm developing a website using visual studio .NET I have a login form with a couple of textboxes and a login button. What I want to do is capture the Enter key so that when the user presses...
3
by: gouthambu | last post by:
Hi all, I have a javascript to limit the text entry in a text area after the size reaches 300 (only thing that should be allowed is left arrow,up arrow, right arrow 39,down arrow,delete and...
2
by: paolo | last post by:
Thanks in advance to everyone that will give me help for these questions. The function formatCurrency is used to auto-format a numeric value with thousands separators and a decimal separator. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.