Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keypress on field 1

Status
Not open for further replies.

lunargirrl

Programmer
Jan 26, 2004
77
BR
I'd like to know how can I make keypress when the enter key is pressed, to jump to the next field on a form.


Thank you.
venusgirrl
 
Code:
function setEnterKey(fieldName) {
 if (event.keyCode == 13) {
   event.cancelBubble = true;
   event.returnValue = false;
   document.getElementById(fieldName).focus();
  }
}

try this out....sending the textbox name for it to set focus...

dlc
 
checkai,

Wouldn't know how to then turn that into a TAB press, would you?

:)
-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
well, tab presses, you should be able to simply set the TABINDEX property on your controls...then tabbing will go automatically...
 
Right, but what I was asking was if you know how to programatically fire off a tab keypress event.

So you catch and shortcircuit the Enter, and then fire a Tab, instead.

Just curious.

Can it be done?

-p

penny.gif
penny.gif

The answer to getting answered -- faq855-2992
 
i see, what you're saying...so if someone is not focused on a button and they hit enter, you want to "pretend" they hit the Tab key...and do this without having to program every text box, list, etc...?

that i'm not sure of...maybe ask that in the Javascript forum...

dlc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top