programming-examples/js/Others/A Checkbox, an onclick Event Handler and show_hide form controls.js

27 lines
767 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
<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>