...

View Full Version : make ENTER key click a button on page



brookey86
05-07-2008, 04:43 PM
I have this working in IE with the code below, but it does nothing in Firefox (and Safari, Opera). Basically if a user clicks the enter key at ANY time, I want the "NEXT" button to be clicked.



function fnTrapKeyDown(e)
{
if (document.all)
{
if (event.keyCode == 13)
{
event.returnValue=false;
event.cancel = true;

document.getElementById("NEXT").click();
}
}
}


Please help me in adapting this for Firefox (and possibly the other two browsers), because I'm stuck.

brookey86
05-07-2008, 05:41 PM
oh also, i have this to call the code above:



document.body.onkeydown=function(){

fnTrapKeyDown(event);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum