Giving focus to an element whose name contains a period

S

Steve Swift

I'm trying to give the focus to a field defined with:
<INPUT TYPE=TEXT NAME=P.LAST_NAME>

and I'm having a spot of bother with that "." in the field's name.

I thought that document.FormName.P\.LAST_NAME.focus() should do the job,
but it doesn't. I've tried a number of variations, with no success, so far.

I could recode my application to use a character other than "." in that
element name (yes, I was asking for trouble) but I'd prefer to know if
there is a way to give focus to such a field.
 
M

Martin Honnen

Steve said:
I'm trying to give the focus to a field defined with:
<INPUT TYPE=TEXT NAME=P.LAST_NAME>

and I'm having a spot of bother with that "." in the field's name.

Generally bracket notation in JavaScript allows you to specify a
property name as an expression yielding a string e.g.
document.forms['form.name'].elements['P.LAST_NAME']
 
S

Steve Swift

Generally bracket notation in JavaScript allows you to specify a
property name as an expression yielding a string e.g.
document.forms['form.name'].elements['P.LAST_NAME']

Just what I needed, thank you!
 

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
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top