By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

Giving focus to an element whose name contains a period

P: n/a
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.

--
Steve Swift
http://www.ringers.org.uk
Sep 2 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Steve Swift wrote:
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']

--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 2 '06 #2

P: n/a
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!

--
Steve Swift
http://www.ringers.org.uk
Sep 2 '06 #3

P: n/a
Steve Swift wrote:
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.
http://www.javascripttoolbox.com/bes...#squarebracket

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com
Sep 2 '06 #4

P: n/a
http://www.javascripttoolbox.com/bes...#squarebracket

That's a very handy reference - thanks - I've bookmarked it!

--
Steve Swift
http://www.ringers.org.uk
Sep 2 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.