By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,203 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,203 IT Pros & Developers. It's quick & easy.

Calling Two Functions

P: n/a
When I click on the "Check All" checkbox, it correctly checks all of
the boxes in my form, but I would like each checkbox to also call
hideLayer2 function just as
what would occur if the user checked the boxes individually. Is there
a way to call the hideLayer2 function and pass the correct whichLayer
and the_box parameters
within the DoToAll function? Maybe there is an easier way? Thanks.
<form name="frmCheckboxes" action="panelstatus.asp" method="post">

<input type="checkbox" onclick="DoToAll(this)">Check All:
<input type="checkbox" name ="chkCompanyBoard"
onClick="hideLayer2('CompanyBoard',this);">Company and Board
Description<br />
<input type="checkbox" name ="chkEvents"
onClick="hideLayer2('Events',this);">Events Reported For This
Company<br />
<input type="checkbox" name ="chkAboutBoard"
onClick="hideLayer2('AboutBoard',this);">About the Board<br />

</form>
function DoToAll(obj_input)
{ bol_is_checked = (obj_input.checked)?true:false
for (x=0;x<obj_input.form.length;x++)
{ obj_input.form.elements[x].checked = bol_is_checked;
}
}
function hideLayer2(whichLayer,the_box)
{
if (the_box.checked == false) {
document.getElementById(whichLayer).style.display = 'none';
var strshowhide=0;
frmPanelStatus.location.href="panelstatus.asp?show hide=" +
strshowhide + "&whichLayer=" + whichLayer;
} else {
document.getElementById(whichLayer).style.display = 'inline';
var strshowhide=1;
frmPanelStatus.location.href="panelstatus.asp?show hide=" +
strshowhide + "&whichLayer=" + whichLayer;

}
}

Jan 23 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Thanks again Lee. I'm getting the error message 'Object required'

function DoToAll(obj_input)
{ bol_is_checked = (obj_input.checked)?true:false
for (x=0;x<obj_input.form.length;x++)
{ obj_input.form.elements[x].checked = bol_is_checked;
hideLayer2(obj_input.form.elements[x]);
}
}
function hideLayer2(the_box)
{
// var the_box = window.document.frmCheckboxes.chkCompanyBoard;
// var the_switch = "";
if (the_box.checked == false) {
whichLayer = the_box.name.substring(3);
document.getElementById(whichLayer).style.display = 'none';
var strshowhide=0;
frmPanelStatus.location.href="panelstatus.asp?show hide=" +
strshowhide + "&whichLayer=" + whichLayer;
} else {
whichLayer = the_box.name.substring(3);
document.getElementById(whichLayer).style.display = 'inline';
var strshowhide=1;
frmPanelStatus.location.href="panelstatus.asp?show hide=" +
strshowhide + "&whichLayer=" + whichLayer;

}
}

Jan 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.