Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] access form.element by name containing [ ]
- From: javascript@xxxxxxxxxx (Rodney Myers)
- Subject: [Javascript] access form.element by name containing [ ]
- Date: Tue, 18 Sep 2001 11:48:44 +0100
<input type="text" name="action[upd]" value="abcd"> <input type="button" name="b1" value="ALERT TEST" onclick="alert(this.form['action[upd]'].value)"> <input type="checkbox" name="action[new]" value="wxyz"> <input type="button" name="b1" value="CLICK TEST" onclick="this.form['action[new]'].click()"> This worked in Win98 NN4.7 and MSIE 5.5 (in my test file crazy.htm<g>) Rodney Patrick Bierans wrote: > "access form.element by name containing [ ]" > > Hello out there. > > I use checkboxes named "action[new]", "action[del]" and > "action[upd]". I have to do it this way because it produces > arrays in PHP making it much (!) easier for me, and I cannot > change it. > > Now I want to access the object in JavaScript by the name > of the checkbox. I cannot use the construct 'elements[2]' > because the position varies. > > I tried theese: > document.forms[0].action[new].click(); > document.forms[0].action\[new\].click(); > document.forms[0].action['new'].click(); > document.forms[0].'action[new]'.click(); > document.forms[0].'action\[new\]'.click(); > > Must I check the name of each element to get the object? > "for each $this as element if $this.name = 'action[new]' $this.click;" > > Isn't there another way? > > TIA, > Patrick Bierans > > P. Bierans > > -- > Patrick Bierans - LYNET Kommunikation AG - http://www.lynet.de > Das Internet-Systemhaus fuer Multimedia- und Netzwerkloesungen > Zentrale Luebeck Fon +49-451-6131-0, Fax +49-451-6131-333 > Niederlassung Hamburg Fon +49-40-65738-0, Fax +49-40-65738-333 > _______________________________________________ > Javascript mailing list > Javascript@xxxxxxxxxx > http://www.LaTech.edu/mailman/listinfo/javascript -- Shop@ssistant Add-ons and Developer Workshops http://www.aflyingstart.net/addons/ Enquiries regarding Shop@ssistant Classic training : Call 01256 880770 Rodney Myers Based in Oxford, England Technical Director, Shop@ssistant eCommerce Solutions
- References:
- [Javascript] access form.element by name containing [ ]
- From: Patrick Bierans
- [Javascript] access form.element by name containing [ ]
- Prev by Date: [Javascript] access form.element by name containing [ ]
- Next by Date: [Javascript] access form.element by name containing [ ]
- Previous by thread: [Javascript] access form.element by name containing [ ]
- Next by thread: [Javascript] Form Validation
- Index(es):