I guess the easy solution would be this:
Stick to the suggestion you got with making button 1 & 3 regular
buttons,
but let button number two (i.e. the one you want to be the default
button) be a submit button.
As in:
<input type=3D"button" name=3D"submitOne" value=3D"submitOne"
onClick=3D"buttonOneSpecificCode()">
<input type=3D"submit" name=3D"submitTwo" value=3D"submitTwo">
<input type=3D"button" name=3D"submitThree" value=3D"submitThree"
onClick=3D"buttonThreeSpecificCode()">
/Robert
-----Ursprungligt meddelande-----
Fr=E5n: sara [mailto:fillet70@h...]
Skickat: den 16 november 2002 03:56
Till: javascript
=C4mne: [javascript] changing default button in html
I have 3 buttons on my form. How do i make one of them the default such
that pressing the enter key corresponds to clicking this button ? As of
now, when i press the enter key the form gets submitted with the
first button and i need my second button to be the default. I dont want
to
change the order of the buttons.
In another posting, somebody had suggested the usage of regular buttons
instead of submit buttons. The click event of each button would call a
Javascript function which would submit the form with the button clicked.
The enter key in this case would not be mapped to any button.
Is there any other solution ?