View Full Version : input with [] in name

09-01-2004, 12:25 AM
<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??


Willy Duitt
09-01-2004, 12:44 AM
Try: document.forms[0]['id[txt_1]']

09-01-2004, 12:47 AM
For further info (from Glenngv's sig) . . .

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


09-01-2004, 12:52 AM
delightful, thank you very much!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum