Determining name of focus() element

P

Paul Thompson

Lasse said:
That would solve the problem, by moving the focus to an object that you
know the name of. I don't think that was what the original poster had in
mind, though :)

By "focus", I assume is meant an input element (like a text field).

There is no simple way of finding the element with focus. What you can
do is to have each input element trigger a script when it gets focus,
and have that script store the element in a global variable. That
way the global variable will point to whatever element has focus.

What is this needed for?
/L

You are 100 % correct. I have decided to set a variable in the onFocus
for each input widget.

What is this for? I have found that using the tab key to shift from one
widget to another works generally. However, when I use focus() to shift
focus to a widget, the use of tab after that is not correct - instead of
tabbing from the last focus object, it tabs from the last TAB event. I
can't figger out why. Have you ever seen this?

Because of this, I am writing an event handler to control tabs correctly.

If you are interested, I can show you a web form which does just what I
said.
 
L

Lasse Reichstein Nielsen

Paul Thompson said:
What is this for? I have found that using the tab key to shift from
one widget to another works generally. However, when I use focus() to
shift focus to a widget, the use of tab after that is not correct -
instead of tabbing from the last focus object, it tabs from the last
TAB event.

So it doesn't follow the focus directly, but continues from where it
was last time you tabbed?
I can't figger out why. Have you ever seen this?

Nope, but I usually leave navigation to the user, so no fiddling with
focus.
Because of this, I am writing an event handler to control tabs correctly.

It is rarely wise to try and emulate a browser feature in javascript. The
browser should be better at it than your code will ever be.
On the other hand, working around a bug is always "fun". :)
If you are interested, I can show you a web form which does just what
I said.

That would be great. And please say which browser exhibits the
problem, and exactly how to recreate it (yes, I'm lazy :).

/L
 
P

Paul Thompson

Lasse said:
So it doesn't follow the focus directly, but continues from where it
was last time you tabbed?




Nope, but I usually leave navigation to the user, so no fiddling with
focus.




It is rarely wise to try and emulate a browser feature in javascript. The
browser should be better at it than your code will ever be.
On the other hand, working around a bug is always "fun". :)




That would be great. And please say which browser exhibits the
problem, and exactly how to recreate it (yes, I'm lazy :).

/L

Use NN, preferably a recent version (6.2 or later; I use 7.1)

go to

http://www.biostat.wustl.edu/~consult/demo/startup.html

Select SCID (the 5th choice), and push WDES Demo Choice

click on Visit and select any one

tab to the next radio button and select ABSENT by hitting <space>

At this point, your focus will be shifted down about 10 rows (follow the
little blue arrow) to the next absent. If you hit <SPACE> again, you
will again be shifted. However, if you hit <TAB>, you will be shifted
back up the screen.

How can I get the <TAB> key synchronized with the FOCUS() ?

Thanks for looking at this!!
 
L

Lasse Reichstein Nielsen

Paul Thompson said:
Use NN, preferably a recent version (6.2 or later; I use 7.1)

I don't have any recent NN. I tried in Mozilla Firebird 0.6 and
Mozilla 1.5a, which should be comparable.
http://www.biostat.wustl.edu/~consult/demo/startup.html ....
However, if you hit <TAB>, you will be shifted back up the screen.

Cannot reproduce the problem, sorry.

I enter the url, select SCID, click the submit button.
On next page, I use the mouse to select an option under "Visit?",
then press TAB, TAB, SPACE (I am now at the absent field further
down the page) and TAB, and end up in Sub-Threshold just after the
previous field.
How can I get the <TAB> key synchronized with the FOCUS() ?

It should work (knock wood).

/L
 

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

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top