How Do i add show/hide button to the below codes?
if I checked one department, the script to show clickable button
for computer, statistics, and physics in case of the first section
and show a single button if i checked two checkboxes in the second section
for instance
a button for computer/statistics
a button for computer/physics
a button for physics/statistics
the codes
[code]<html>
<head>
<script type=”text/javascript”>
function checkboxlimit(checkgroup, limit){
var checkgroup=checkgroup
var limit=limit
for (var i=0; i<checkgroup.length; i++){
checkgroup[i].onclick=function(){
var checkedcount=0
for (var i=0; i<checkgroup.length; i++)
checkedcount+=(checkgroup[i].checked)? 1 : 0
if (checkedcount>limit){
alert(“You can only select a maximum of “+limit+” checkboxes”)
this.checked=false
}
}
}
}
</script>
</head>
<body>
<p>Select your favorite deparments below:</p>
<form id=”department” name=”department”>
<input type=”checkbox” name=”department” /> Computer<br />
<input type=”checkbox” name=”department” /> Physics<br />
<input type=”checkbox” name=”department” /> Statistics<br />
</form>
<script type=”text/javascript”>
//Syntax: checkboxlimit(checkbox_reference, limit)
checkboxlimit(document.forms.department.department, 1)
</script><p>Select your favorite two deparments below:</p>
<form id=”depart” name=”department”>
<input type=”checkbox” name=”department” /> Computer<br />
<input type=”checkbox” name=”department” /> Physics<br />
<input type=”checkbox” name=”department” /> Statistics<br />
</form>
<script type=”text/javascript”>
//Syntax: checkboxlimit(checkbox_reference, limit)
checkboxlimit(document.forms.depart.department, 2)
</script>
</body>
</html>
**Edited by site staff: Inserted code tags
“[code]your code here[/code]