tags:

views:

33

answers:

1

Hi,

I have a method called checkKeyCode(obj) which simply takes the character you type into a textbox and replaces it with its keyCode.

This method is called from onkeydown attribute of textbox input (onkeydown="return checkKeyCode(this)").

The problem is then I want to be able to press tab and focus to the next element. I don't have to know the element's id or name or tag. Basically I want to combine my method's funtionality with the default functionality of browser when you press Tab key (which sets focus to the next element in the form).

Can this be done. If so how?

Any help would be greatly appreciated.

A: 

Check the keycode in your handler and if the value is 9, it's a tab. Exit your handler if it is and return false.

Also, don't use the onkeydown event. Use onkeyup instead.

Robusto