...

View Full Version : designating a button through 'ENTER'



Ultragames
03-09-2005, 11:26 PM
I have 2 submit buttons. Without rearranging the order of the buttons, how can i make the enter (return) button submit the submit button i want?

mcdougals4all
03-10-2005, 12:25 AM
Can you post some code?

Ultragames
03-10-2005, 08:09 AM
<form action='page' method='post'>
<input type='text' name='variable'>
<input type='submit' value='Enter 1' onClick='action()'>
<input type='submit' value='Enter 2'>
</form>

Obviously just an example. But I would want button 'Enter 2' to be submitted when they hit return on their keyboards, not 'Enter 1'. How?

(I cant rearrange them)

Scrowler
03-10-2005, 08:29 AM
something like <form onLoad="document.form.button2.focus()">

btw, name your buttons!

Ultragames
03-10-2005, 10:45 PM
In my actual script they are named.

Will the point of giving it focus be lost once they click inside another field?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum