25 Jul
2001
25 Jul
'01
3:58 a.m.
From: "Albert Ting" <alt@sonic.net>
Form type variables are great, but it causes a problem with Javascript. Example:
<input name="default" type="checkbox" onClick="setDefault(this,this.form.name:list)"> <input name="name:list" type="text">
This doesn't work, as Javascript won't recognize name:list as a variable name when calling setDefault. I've tried various combinations with no such luck. Any suggestions?
This should work: <input name="default" type="checkbox" onClick="setDefault(this,this.form['name:list'])"> In general, Javascript allows you to use "container['name']" notation instead of "container.name". Cheers, Evan @ digicool & 4-am