View Single Post
Old 10-09-2012, 03:15 PM   PM User | #5
outspoken
New to the CF scene

 
Join Date: Oct 2012
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
outspoken is an unknown quantity at this point
ya broke me down..

First off, nice code xelawho!
If I throw a wrench, could you throw it back, please?
My interest is to have multiple checkboxes and if (any) are checked, then show the div, but if none are checked, then hide the div.

my lame modification of your code fails by hiding the div as soon as any checkbox is uncheck.

how would you write it so it won't hide the div until (all) checkboxes are unchecked?

my lame modification of your code:

Code:
<head>
<style>
#feature{display:none}
</style>
</head>
<body>
Would you like to use Feature A?<br>
<input name="Ready[]" type="checkbox" onclick="showFeat(this)" value="1" /><br>
<input name="Ready[]" type="checkbox" onclick="showFeat(this)" value="2" /><br>
<input name="Ready[]" type="checkbox" onclick="showFeat(this)" value="3" /><br>
<input name="Ready[]" type="checkbox" onclick="showFeat(this)" value="4" /><br>
<input name="Ready[]" type="checkbox" onclick="showFeat(this)" value="5" /><br>
<div id="feature"><input name="submit" type="submit" value="submit"></div>
<script>
function showFeat(box){
document.getElementById("feature").style.display=box.checked?"block":"none";
}
</script>
</body>
Thanks in advance for your assistance.
outspoken is offline   Reply With Quote