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
- document.onkeyup = HandleKeyup;
- function HandleKeyup(e){
- if(!e){
- e = window.event;
- }
- if(e.keyCode == 13){
- SomeFunction();
- }
- }
Veronica