麻煩各位幫我看一下代碼,關閉按鈕沒有反映,請問問題出在哪里,謝謝!??!
<style type="text/css">
?? ??? ?.rightAd{
?? ??? ??? ?height:300px;
?? ??? ??? ?width:400px;
?? ??? ??? ?background:#ccc;
?? ??? ??? ?position:fixed;
?? ??? ??? ?right:5px;
?? ??? ??? ?bottom:0px;
?? ??? ?}
?? ??? ?.CloseBtn{
?? ??? ??? ?background:url(icon.jpg) no-repeat -399px -19px;
?? ??? ??? ?width:16px;
?? ??? ??? ?height:16px;
?? ??? ??? ?display:none;
?? ??? ??? ?position:absolute;
?? ??? ??? ?top:5px;
?? ??? ??? ?right:5px;
?? ??? ?}
?? ??? ?.CloseBtn:hover{
?? ??? ??? ?background-position: -343px -19px;
?? ??? ?}
?? ??? ?.Flex{
?? ??? ??? ?background:#CCC;
?? ??? ??? ?height:24px;
?? ??? ??? ?line-height:24px;
?? ??? ??? ?position:relative;
?? ??? ??? ?text-align:center;
?? ??? ?}
?? ??? ?
?? ??? ?</style>
?? ??? ?<script type="text/javascript">
?? ??? ?window.onload=function(){
?? ??? ??? ?var TipBox=document.getElementById("tipCon");
?? ??? ??? ?var CloseBtn=document.getElementById("CloseBtn");
?? ??? ??? ?var Flex=document.getElementById("Flex");
?? ??? ??? ?var Eddie=document.getElementById("Eddie");
?? ??? ??? ?Flex.onmouseover = function(){
?? ??? ??? ??? ?Eddie.style.display = 'block';
?? ??? ??? ??? ?CloseBtn.style.display = 'block';
?? ??? ??? ?}
?? ??? ??? ?CloseBtn.onclick = function(){
?? ??? ??? ??? ?Eddie.style.display = 'none';
?? ??? ??? ??? ?CloseBtn.style.display = 'none';
?? ??? ??? ?}
?? ??? ?}
?? ??? ?</script>?? ??? ?
?? ?</head>
?? ?<body>
?? ??? ?<div class="rightAd" id="tipCon">
?? ??? ??? ?<div class="Flex" id="Flex">鼠標來這里</div>
?? ??? ??? ?<div class="CloseBtn" id="CloseBtn">
?? ??? ??? ??? ?<a href="javascript:void(0);" ></a>
?? ??? ??? ?</div>
?? ??? ??? ?<div class="Eddie" id="Eddie">
?? ??? ??? ??? ?<a href="http://www.xianlaiwan.cn">
?? ??? ??? ??? ??? ?<img src="Eddie.jpg" />
?? ??? ??? ??? ?</a>
?? ??? ??? ?</div>
?? ??? ?</div>
?? ?</body>
2016-10-06
你只是把icon 隱藏了,沒有把廣告整體隱藏。
CloseBtn.onclick事件中加上? TipBox.style.display = "none"; 就可以了