@
@(none)
I have a page which is a set of CheckBoxes generated daily and thus the
number of Checkboxes changes each day.
What I want to do is allow the user to select one or more checkboxes and
the push a "Done" button and then have a script which uses a "for" loop
to check the status of each box. The code I use for this is
Sample checkbox HTML
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox0"
VALUE="AFL"> "AFL, Score = -2"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox1"
VALUE="ALL"> "ALL, Score = 1"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox2"
VALUE="ANN"> "ANN, Score = 6.15"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox3"
VALUE="BBA"> "BBA, Score = 3"
code to check the State of each checkbox
for ( i=0; i<num; i++ ) {
n = i.toString()
s = "document.Select.CheckBox" +n +".checked"
if ( s ) {
alert ( s )
}
alert ("Done")
If I use "document.Select.CheckBox0.checked" in the "if" it works OK.
The problem is building the "if" parameter in the for loop and maybe I
am missing the point about type conversion - although I have googled for
info and ther doesn't appear to be a type conversion. I dont think I can
use a string in the "if" - so how do I build a type that "if" is happy
with ??
Hope someone can help - Thanks.
number of Checkboxes changes each day.
What I want to do is allow the user to select one or more checkboxes and
the push a "Done" button and then have a script which uses a "for" loop
to check the status of each box. The code I use for this is
Sample checkbox HTML
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox0"
VALUE="AFL"> "AFL, Score = -2"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox1"
VALUE="ALL"> "ALL, Score = 1"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox2"
VALUE="ANN"> "ANN, Score = 6.15"
<P STYLE="margin-left: 1.5in"><INPUT TYPE=CHECKBOX NAME="CheckBox3"
VALUE="BBA"> "BBA, Score = 3"
code to check the State of each checkbox
for ( i=0; i<num; i++ ) {
n = i.toString()
s = "document.Select.CheckBox" +n +".checked"
if ( s ) {
alert ( s )
}
alert ("Done")
If I use "document.Select.CheckBox0.checked" in the "if" it works OK.
The problem is building the "if" parameter in the for loop and maybe I
am missing the point about type conversion - although I have googled for
info and ther doesn't appear to be a type conversion. I dont think I can
use a string in the "if" - so how do I build a type that "if" is happy
with ??
Hope someone can help - Thanks.