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