Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

handling full stops (.) in element names (IE)

Status
Not open for further replies.

Streetdaddy

Programmer
Jun 10, 1999
161
0
0
AU
Say I have an element e.g.

<input name=&quot;that.there&quot; value=&quot;Hello World&quot;>

the following javascript gives an error in IE:

alert(form['that.there'].value

(nb. the form is named 'form')

If the element name has no . in it, it's fine. Is there a way I can handle the full stop in the element name? I have tried everything I can think of, but that may not be everything that is possible ;) Miles

Those Micros~1 guys sure know what they doing!
 
hi Miles,

it's very poor form to use dots &quot;.&quot; in field names, and should be avoided...but if you must, the only way i can think of to handle them will be to use their index.

<form>
<input name=&quot;index.zero&quot; />
<input name=&quot;index.one&quot; />
</form>

in this example, [tt]document.forms[0].elements[0].name[/tt] is &quot;index.zero&quot;
=========================================================
if (!succeed) try();
-jeff
 
Don't I know it! Unfortunately the code was written by another member of the dev team who has now left. I am the luck person who has to work around his weird coding. The full stops were used as the application uses Struts. Miles

Those Micros~1 guys sure know what they doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top