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

Pass Checkbox name to function

P: n/a
I'm passing a div name to a function to hide or close it like this but
I also want to pass the checkbox name value so I know which one was
checked. I have the chkCompanyBoard value hard-coded in there now.
How would I do this? Thanks.

<form name="frmCheckboxes">
<input type="checkbox" name ="chkCompanyBoard"
onClick="hideLayer2('CompanyBoard');">Company and Board Description
</form>

<div id="CompanyBoard">stuff</div>
function hideLayer2(whichLayer)
{
var the_box = window.document.frmCheckboxes.chkCompanyBoard;
var the_switch = "";
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 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

<ev*******@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I'm passing a div name to a function to hide or close it like this but
I also want to pass the checkbox name value so I know which one was
checked. I have the chkCompanyBoard value hard-coded in there now.
How would I do this? Thanks.

<form name="frmCheckboxes">
<input type="checkbox" name ="chkCompanyBoard"
onClick="hideLayer2('CompanyBoard');">Company and Board Description
</form>

<div id="CompanyBoard">stuff</div>
function hideLayer2(whichLayer)
{
var the_box = window.document.frmCheckboxes.chkCompanyBoard;
var the_switch = "";
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;

}
}


onClick="hideLayer2('CompanyBoard','chkCompanyBoar d');">Company and Board
Description

function hideLayer2(whichLayer,whichButton)
Jan 20 '06 #2

P: n/a
Thanks. How would I handle this line?

var the_box = window.document.frmCheckboxes.chkCompanyBoard

I want to var the_box to be assigned to whatever box is checked and not
just chkCompanyBoard

Jan 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.