This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes keyCode - firefox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "keyCode - firefox" Watch "keyCode - firefox" New topic
Author

keyCode - firefox

Joe Shannow
Ranch Hand

Joined: Dec 01, 2010
Posts: 35
Hi,
is here anybody who knows how to rewrite this javascript function (which works in IE8) to firefox?

function enter2tab(){
if(window.event.keyCode == 13 && window.event.srcElement.id !='scrap:btnSubmit') window.event.keyCode = 9;
}

When I press enter in irefox, form is submitted......
Joe Shannow
Ranch Hand

Joined: Dec 01, 2010
Posts: 35
Some progress:

function enter2tab(e) {
if (e.keyCode == 13)
{
e.cancelBubble = true;
e.preventDefault();
e.returnValue = false;
e.keyCode = 9;
}
}

....onkeypress="enter2tab(event); ">

this function forbids enter to submitt form... but not change the key pressed to tab
Joe Shannow
Ranch Hand

Joined: Dec 01, 2010
Posts: 35
Hmm, firefox seems not to be able to CHANGE key events on run.
I think, it can sniff the e.keyCode and tell what the key was pressed, but not to change it.

Am I right?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: keyCode - firefox
 
Similar Threads
No window.event in firefox ?
ALT Key Combination help.
Replace keycode value in Firefox
Error in FF
IE vs FF window.event issue