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!

Enter behavior..? 1

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
SE
Hi all,

How can I get the 'Enter' button to behave the same way as the 'Tab' button on a Web-Form?

/Kent J.
 
u have to write a code that will capture the KeyCode, try this for a start:
<input type=&quot;text&quot; onkeydown=&quot;alert(event.keyCode())&quot;>

this will give a series of ascii values, capture the value of enter and do whatever u wanna do...

Known is handfull, Unknown is worldfull
 
vbkris,

Thanks! But I get a script error:
...
Error: 'The object cannot handle this action'
Code: 0
...

 
Hello kenjoswe,

Try take out the ().
Code:
<input type=&quot;text&quot; onkeydown=&quot;alert(event.keyCode)&quot;>
regards - tsuji
 
ah, sorry...

Known is handfull, Unknown is worldfull
 
But how can I convert keycode=13 (Enter) to keycode 9 (Tab)?

/Kent J.
 
dont convert,
if(keycode==13)
{
document.Form.TextFieldToBeGivenFocus.focus()
}

Known is handfull, Unknown is worldfull
 
You may also want to try this...

window.document.onkeydown = convertEnterToTab;

function convertEnterToTab() {

if (window.event.keyCode == 13) {
window.event.keyCode = 9;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top