programming-examples/js/Others/A Checkbox and an onclick Event Handler.js
2019-11-15 12:59:38 +01:00

27 lines
767 B
JavaScript

<html>
<head>
<title>Checkbox Event Handler - Happy Codings :-) JavaScript Code Examples</title>
<style type="text/css">
#myGroup {visibility:hidden}
</style>
<script type="text/javascript">
function toggle(chkbox, group) {
var visSetting = (chkbox.checked) ? "visible" : "hidden";
document.getElementById(group).style.visibility = visSetting;
}
function swap(radBtn, group) {
var modemsVisSetting = (group == "modems") ? ((radBtn.checked) ? "" : "none") : "none";
document.getElementById("modems").style.display = modemsVisSetting;
}
</script>
</head>
<body>
<form>
<input type="checkbox" name="monitor" onclick="toggle(this, 'myGroup')" />Monitor
<span id="myGroup">
<input type="radio" />15"
</span>
</form>
</body>
</html>