首页 > 代码库 > Js可点击展开关闭的广告代码

Js可点击展开关闭的广告代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>网页上可点击展开、关闭的左侧广告代码</title>
</head>
<body>
<div id="Bar1190_big" style="position:absolute;z-index:9;top:10px;left:0px;width:100px;height:300px;">
<div id="AD1190" style="width:100px;height:300px;text-align:center;float:none" class="adSpace">
<a href="http://www.mamicode.com/" target="_blank"><img width="100" height="300" src="http://www.mamicode.com/jscss/demoimg/201403/2401.jpg" border="0"></a>
</div>
<div style="height:18px;width:100px;background:#CCCCCC;text-align:right;line-height:18px;">
<a style="font-size:12px;cursor:pointer;" onClick="bar1190_hidden()">关 闭</a>
</div>
</div>
<div id="Bar1190_small" style="position:absolute;z-index:9;top:10px;display:none;left:0px;width:20px;height:300px;">
<div id="AD1190" style="width:20px;height:300px;text-align:center;float:none" class="adSpace">
<a href="http://www.mamicode.com/" target="_blank"><img width="25px" height="300" src="http://www.mamicode.com/jscss/demoimg/201403/2402.jpg" border="0"></a>
</div>
<div style="height:18px;width:25px;background:#CCCCCC;text-align:right;line-height:18px;">
<a style="font-size:12px;cursor:pointer;" onClick="bar1190_show()">展开</a>
</div>
</div>
<script type="text/javascript">function bar1190_show(){document.getElementById(‘Bar1190_big‘).style.display=‘‘;document.getElementById(‘Bar1190_small‘).style.display=‘none‘;}function bar1190_hidden(){document.getElementById(‘Bar1190_big‘).style.display=‘none‘;document.getElementById(‘Bar1190_small‘).style.display=‘‘;}var autohide1190 = setTimeout("bar1190_hidden()",6000);</script>
</body>
</html>