浮动广告

<div id=”myad” style=” position:absolute; top:200px; left:280px; width:400px; height:300px; filter:alpha(opacity=50)”>
<div id=”myadclose” style=”right:0px; top:0px; position:absolute”>关闭</div>
<table>
<tr><td>dsfsdfsdfdsfdsf11111111111111111sssssssssss</td></tr>
</table>
</div>
<script>

//content是广告的内容的id,closebutton是关闭按钮的id,showtime是停留的毫秒数
//广告和关闭按钮的具体位置在调用前自定义style定位,透明度使用filter来控制。如:
//this.style.filter=”alpha(opacity=’50’);”;
function createFloatAD(content, closebutton, showtime) {
var maxzindex = 2147483647;
var seconds = showtime || 1000;
var txtContent = document.getElementById(content);
txtContent.style.zIndex = maxzindex;
var btnClose   = document.getElementById(closebutton);
btnClose.style.zIndex = maxzindex;

btnClose.onclick = function() {
txtContent.style.display = “none”;
};
setTimeout(btnClose.onclick, seconds);
}
createFloatAD(“myad”, “myadclose”, 3000);
</script>

打赏

发表评论

电子邮件地址不会被公开。 必填项已用*标注