js如何通过CheckBox值显示/隐藏RadioButton

  时间:2017-03-22
本文章向大家介绍javascript如何通过CheckBox值显示/隐藏RadioButton,需要的朋友可以参考一下本文章的实例。

js如何通过CheckBox值显示/隐藏RadioButton,实现方法如下:

<html> 
<head> 
<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>

原文地址:http://www.manongjc.com/article/1820.html