Forum Moderators: open

Message Too Old, No Replies

Changing which button in a form looks to be the default button

You know that darker border you get around a button when it is default.....

         

bhonda

10:03 am on May 25, 2006 (gmt 0)

10+ Year Member



Hey,

I be a .NET programmer, so my knowledge of Javascript is quite limited - can get basic stuff done, but if I've not done it in the past, then I've really got no idea where to start!

Here lieth the problem...

I have a form. I have many textboxes. I have 2 buttons. Depending on the state of the page (ie, what the user has done), when they press 'Enter' either button is 'clicked'. This is all sorted, and works well.

...BUT...

The first button has a darker border around it, (not set by css or anything, but is default behaviour I guess) indicating that it is the default button. Half the time, when the user presses 'Enter', this button is clicked, so all is fine and dandy. The rest of the time, the other button is fired, but the other button is still selected. Is there any way to change which button looks to be the default button, using Javascript (or anything else, if it gets the job done!)

Has anyone got any clue whatsoever what I'm trying to get at? Hehe - I'm afraid I don't even know the technical term for this, so I can't efficiently Google it, but I'm sure it's been done before!

Cheers,

B

mrhoo

2:38 pm on May 26, 2006 (gmt 0)

10+ Year Member



Set button.focus(); where button is the button you want selected on click or keypress

bhonda

2:57 pm on May 26, 2006 (gmt 0)

10+ Year Member



Cheers - I'll have a look at that!

B