js点击判断显示或隐藏-21
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
div{ width:200px; height:100px; border:1px #999999 solid; margin-top:10px;}
</style>
<script>
function sw(){
var divid=document.getElementById('box2');
if(divid.style.display=='none'){
divid.style.display='block'
}else{
divid.style.display='none'
};
};
</script>
</head>
<body>
<div id="box1"><button onClick="sw()">显示、隐藏</button></div>
<div id="box2" style="display:none;"></div>
</body>
</html>
南瓜小园 —— 从零开始,重构想象!