两个div 先写好,一个先隐藏,点击后更改其属性,让其显示
<!doctype html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
outer{
position: relative;
height: 300px;
width: 500px;
background-color: #097df3;
}
d1{
display: none;
position: absolute;
height: 200px;
width: 300px;
top: 50px;
left: 100px;
background-color: #FF6C00;
}
</style>
</head>
<body>
<div class="outer" onclick="fn()">
<div class="d1"></div>
</div>
<script>
function fn(){
documentgetElementsByClassName('d1')[0]styledisplay = "block";
}
</script>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)