...

View Full Version : input with [] in name



tensio
08-31-2004, 11:25 PM
<SCRIPT LANGUAGE="JavaScript">writeSource("jscal1x");</SCRIPT>
<INPUT TYPE="text" NAME="id[txt_1]" VALUE="" SIZE=25>
<A HREF="javascript:cal1x.select(document.forms[0].id[txt_1],'anchor1x','MM/dd/yyyy');" NAME="anchor1x" ID="anchor1x">select</A>


Problem - the name of the input field MUST be "id[txt_1]" as it is part of a php shopping cart that I don't want to mess with BUT the javascript won't run with an input name with []. Is there a way around??

thanks!

Willy Duitt
08-31-2004, 11:44 PM
Try: document.forms[0]['id[txt_1]']

Basscyst
08-31-2004, 11:47 PM
For further info (from Glenngv's sig) . . .

Using Square Bracket Notation (http://www.litotes.demon.co.uk/js_info/sq_brackets.html)

Basscyst

tensio
08-31-2004, 11:52 PM
delightful, thank you very much!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum