473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Giving focus to an element whose name contains a period

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
4 3808


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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul Thompson | last post by:
How do I determine in JavaScript the name of the object that focus is on?
10
by: CES | last post by:
All, I'm having a problem returning focus back to an input field in Netscape. The code works in IE and Opera but not in netscape6+. Basically I have a function that is called upon...
4
by: CharlesTheHawk | last post by:
I thought this would be really simple, but i'm stumped. I'd like to validate some data without submitting the form, but i can't seem to get the focus to go back to the field with the bad data. I've...
31
by: Benno Bös | last post by:
If I use the following construct in the frame "main" for a link to an extern site: <A HREF="http://www.any.xy" TARGET="extern"> the Browser is creating the window "extern", loading the page...
3
by: Philip Townsend | last post by:
I have an aspx page that contains 2 user controls, each containing a seperate textbox and button. I would like to specify that one of the buttons recieve focus when the page loads. Also, I would...
9
by: fidodido | last post by:
If in the textarea (textarea3), the value is not "abc", and the user uses "Tab" to go to the next textarea (textarea4), it will alert an error message...and the focus will return to the textarea...
1
by: Mike | last post by:
I have an intranet page which has an iframe which links to a number of different possible .NET pages. In one of the embedded .NET pages (and soon to be others) we want to be able to capture...
2
dlite922
by: dlite922 | last post by:
Before traversing my code, here's what my goal is and what this function does: I have a table of fields that dynamically grows as the user enters information. A minimum of 3 rows must always...
4
Claus Mygind
by: Claus Mygind | last post by:
I am creating an element dynamically as I load it on the screen. When it was hard coded on the page I had no problem executing the following two lines. document.getElementById("SEARCH").select();...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.