HI,
 
I am using following script to generate checkboxes and check them all on my jsp.
 
<SCRIPT LANGUAGE="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {//ERROR OCCURING HERE
field[i].checked = true;}
checkflag = "true";
return "Uncheck All"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "Check All"; }
}
 
<input type=checkbox name="book_all" value="Check All" 
onClick="check(this.form.list)"></th>
 
//so if user clicks above checkbox (which, on the resultant HTML page, appears above 
all the remaining rows in the table, each row has a checkbox., should check all the 
remaining checkboxes under it.

When I run my script, i get error at above line - saying "length" is null.

Wondering why.

Any tips appreciated.

Thanks,

Sa.

 

Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam

Reply via email to