vik001
07-27-2005, 02:00 PM
<view name="p1" layout="axis:x">
<checkbox id="hrsView1" text="1 am" value="0"/>
<checkbox id="hrsView2" text="2 am" value="0"/>
<checkbox id="hrsView3" text="3 am" value="1"/>
<checkbox id="hrsView4" text="4 am" value="0"/>
<checkbox id="hrsView5" text="5 am" value="0"/>
<checkbox id="hrsView6" text="6 am" value="0"/>
<checkbox id="hrsView7" text="7 am" value="0"/>
<checkbox id="hrsView8" text="8 am" value="0"/>
<checkbox id="hrsView9" text="9 am" value="0"/>
<checkbox id="hrsView10" text="10 am" value="0"/>
<checkbox id="hrsView11" text="11 am" value="0"/>
<checkbox id="hrsView12" text="12 pm" value="0"/>
</view>
I want to have a link where onclick, all the checkboxes should toggle from on to off and viceversa.
Instead of going hrsView1... hrsView12.setAttribute('value',1) and back, I am trying to put it in a for loop, but for some reason its not working.
<text text="Select all">
<method event="onclick">
for (i=1;i<25;i++){
var cbox ='hrsView'+i;
Debug.write(cbox);
cbox.setAttribute('value',1);
}
</method>
</text>
This does not seem to work. Any ideas?
Thanks.
V./
<checkbox id="hrsView1" text="1 am" value="0"/>
<checkbox id="hrsView2" text="2 am" value="0"/>
<checkbox id="hrsView3" text="3 am" value="1"/>
<checkbox id="hrsView4" text="4 am" value="0"/>
<checkbox id="hrsView5" text="5 am" value="0"/>
<checkbox id="hrsView6" text="6 am" value="0"/>
<checkbox id="hrsView7" text="7 am" value="0"/>
<checkbox id="hrsView8" text="8 am" value="0"/>
<checkbox id="hrsView9" text="9 am" value="0"/>
<checkbox id="hrsView10" text="10 am" value="0"/>
<checkbox id="hrsView11" text="11 am" value="0"/>
<checkbox id="hrsView12" text="12 pm" value="0"/>
</view>
I want to have a link where onclick, all the checkboxes should toggle from on to off and viceversa.
Instead of going hrsView1... hrsView12.setAttribute('value',1) and back, I am trying to put it in a for loop, but for some reason its not working.
<text text="Select all">
<method event="onclick">
for (i=1;i<25;i++){
var cbox ='hrsView'+i;
Debug.write(cbox);
cbox.setAttribute('value',1);
}
</method>
</text>
This does not seem to work. Any ideas?
Thanks.
V./