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

Grabbing Checkbox Value

P: n/a
I'm passing the name of a div and the name of checkbox to this function
which either hides or displays the div. My problem is this line

// var the_box = window.document.frmCheckboxes.chkCompanyBoard;

I want to assign the name of the checked checkbox to var the_box rather
than just hard-code chkCompanyBoard
function hideLayer2(whichLayer,the_box)
{
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;

}

}

<form name="frmCheckboxes">
<table border="0" width="95%" align="center">
<tr>
<td><input type="checkbox" name ="chkCompanyBoard"
onClick="hideLayer2('CompanyBoard',this);">Company and Board
Description</td>
<td><input type="checkbox" name ="chkEvents"
onClick="hideLayer2('Events',this);">Events Reported For This
Company</td>
<td><input type="checkbox" name ="chkAboutBoard"
onClick="hideLayer2('AboutBoard',this);">About the Board</td>
</tr>
<tr>
<td><input type="checkbox" name ="chkCommittees"
onClick="hideLayer2('Committees');">Current Committee Assignments</td>
<td><input type="checkbox" name ="chkTransactions"
onClick="hideLayer2('Transactions');">Related Party Transactions</td>
<td><input type="checkbox" name ="chkConnections"
onClick="hideLayer2('Connections');">Director Connections</td>
</tr>

</table>
</form>
<div id="CompanyBoard">stuff</div>
<div id="Events">stuff</div>
<div id="AboutBoard">stuff</div>

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


P: n/a
Thanks a lot.

Jan 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.