<input type="button" id="man" value="男" onclick="show()" checked="checked" >
<input type="button" id="woman" value="女" onclick="show()" checked="checked">
<p style="display:none" id="div1">男性</p>
<p style="display:none" id="div2">女性</p>
</body>
<script type="text/javascript">
function show(){
if(document.getElementById("man").checked){
document.getElementById("div1").style.display="block";
document.getElementById("div2").style.display="none";
}
else if(document.getElementById("woman").checked){
document.getElementById("div2").style.display="block";
document.getElementById("div1").style.display="none";
}
}
</script>
相关分类