首页 > Web开发 > 详细

js练习关闭小广告

时间:2020-05-25 22:14:31      阅读:50      评论:0      收藏:0      [点我收藏+]

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
/*清除默认样式*/
*{
margin: 0;
padding: 0;
}
#qecode{
width: 200px;
height: 160px;
/*子元素绝对定位 父元素相对定位*/
position: relative;
/*background-color: red;*/
margin: 200px auto;
}
#qecode img{
width: 180px;
height: 160px;
position: absolute;
right: 0;
}
#qecode #close{
position: absolute;
width: 18px;
height: 18px;
border: 1px solid #e0e0e0;
text-align: center;
line-height: 18px;
/*鼠标箭头*/
cursor: pointer;
color: #666666;
}
</style>
</head>
<body>
<div id="qecode">
<img src="img/79d353ccd7d7d65fd3b8c72f2cb1b94.jpg" id="code" />
<span id="close">x</span>
</div>

<script type="text/javascript">
var closebtn = document.getElementById(‘close‘);
var qecode = document.getElementById(‘qecode‘);
closebtn.onclick = function(){
qecode.style.display=‘none‘;
}
</script>
</body>
</html>

js练习关闭小广告

原文:https://www.cnblogs.com/weixin2623670713/p/12960892.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!