如何用css+js实现点击按钮弹出div
展开全部
<head>
<title></title>
<style type="text/css">
.div1{position:absolute;display:none;}
.div2{position:absolute;display:none;}
</style>
<script type="text/javascript">
function div1Show() {
var div1 = document.getElementById("div1");
div1.style.display = "";
}
function div2Show() {
var div1 = document.getElementById("div1");
var div2 = document.getElementById("div2");
div1.style.display = "none";
div2.style.display = "";
}
</script>
</head>
<body>
<div id="div1" class="div1">
</div>
<div id="div2" class="div1">
<input type="button" value="btn2" id="btn2" onclick="div2Show()" />
</div>
<input type="button" value="btn1" id="btn1" onclick="div1Show()"/>
</body>
</html>
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询