trying to work with focus on a control

D

David

Here is the layout of my form from left to right, from top to down.

- buttonA, buttonB, buttonC
- textbox, textbox, textbox
- buttonXXX

After the user types in the textboxes and press enter (with the cursor still
in one of the textboxes), buttonXXX should be pressed by default.(the user
is too lazy to take the cursor over to buttonXXX and click).

The problem is the top/left most button (button A) gets pressed which annoys
them to death. So I tried to do this.

In the bottonA's onfocus event handle

document.forms[0].elements['buttonXXX'].focus() .

Result: ButtonXXX receives focus alright, but the code for buttonA still
executes! Any help would be greatly appreciated.

I posted this question earlier and someone suggested using this control from
MetaBuilder which allows you to set the first control to receive focus. In
this case, the user fills out a bunch of textboxes (so the focus is on one
of the textboxes at this point), then presses enter. I don't think onenter
is one of the attributes that can be programmed against.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top