W
Wendy S
I have this working, but I don't think it's done efficiently or the best
way:
<a href="javascript:setAllAccounts(true)">check all</a>
<a href="javascript:setAllAccounts(false)">clear all</a>
function setAllAccounts(value) {
for(i = 0 ; i < document.forms[0].accounts.length; i++ ) {
document.forms[0].accounts.checked = value; } }
And the form has:
<input type="checkbox" name="includeDetail" value="on">
<input type="checkbox" name="accounts" value="99_A_ABCD1234">
<input type="checkbox" name="accounts" value="88_B_EFGH5678">
So it checks only the 'accounts' checkboxes, and leaves the 'includeDetail'
one alone.
First, I don't think the javascript: in the href is recommended. And
second, could I have a function:
setAll( fieldname, value)
instead? If so, how would I do the for loop? My initial attempts just
produced errors.
Thanks,
Wendy in Chandler, AZ
way:
<a href="javascript:setAllAccounts(true)">check all</a>
<a href="javascript:setAllAccounts(false)">clear all</a>
function setAllAccounts(value) {
for(i = 0 ; i < document.forms[0].accounts.length; i++ ) {
document.forms[0].accounts.checked = value; } }
And the form has:
<input type="checkbox" name="includeDetail" value="on">
<input type="checkbox" name="accounts" value="99_A_ABCD1234">
<input type="checkbox" name="accounts" value="88_B_EFGH5678">
So it checks only the 'accounts' checkboxes, and leaves the 'includeDetail'
one alone.
First, I don't think the javascript: in the href is recommended. And
second, could I have a function:
setAll( fieldname, value)
instead? If so, how would I do the for loop? My initial attempts just
produced errors.
Thanks,
Wendy in Chandler, AZ