I want to keep the handler where if the parent check-boxes is unchecked, the child check-boxes hide.
However, currently it does not at the same time un-boxes the child check-boxes.
I would like the child check-boxes to be unchecked as well.
Here is my code:
<!DOCTYPE html>
<html>
<head>
<title>Your title</title>
<script type="text/javascript">
function showMe(it, box) {
var display = (box.checked) ? "block" : "none";
document.getElementById(it).style.display = display;
}
function OpenAll() {
alert("Case Study Available!");
var i, data = document.forms[0].box;
for(i = 0; i < data.length; i++) {
if(data[i].checked) {
window.open(data[i].value.toString());
}
}
}
</script>
</head>
<body>
<form method="post">
<input name="pumps" onclick="showMe('div1', this)" type="checkbox" value="http://www.expedia.com">Pumps
<div class="right" id="div1" style="display:none">
<blockquote>
<input name="cent" type="checkbox" value="http://www.facebook.com">Centrifugal
</blockquote>
<blockquote>
<input name="rot" onclick="showMe('div2', this)" type="checkbox" value="http://www.google.com">Rotary
</blockquote>
<blockquote>
<div class="right" id="div2" style="display:none">
<blockquote>
<input name="50HP" type="checkbox">Less Than 50HP
</blockquote>
<blockquote>
<input name="100HP" type="checkbox">50HP - 100HP
</blockquote>
</div>
</blockquote>
</div><br>
<input name="ovens" type="checkbox" value="http://www.yelp.com">Ovens<br>
<input onclick="OpenAll()" type="submit" value="Save">
</form>
</body>
</html>