您的位置:首页 > 运维架构 > 网站架构

三俗网站必备之动态广告

2015-12-28 14:35 429 查看
就是一个小方框在整个页面内乱晃内容很黄很暴力的那种

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
.one{
width:200px;
height:220px;
background-color:#CC3;
position:absolute;
top:0px;
left:0px;
cursor:pointer;
}
</style>
<script>
window.onload = function(){
var div1= document.getElementsByTagName("div")[0];
var sx=5,sy=5,x,y;
var timer = setInterval(startMove,20);
function startMove(){
if(document.documentElement.clientWidth - x < div1.offsetWidth || x<0) {
sx = -sx;
}
if(document.documentElement.clientHeight - y < div1.offsetHeight || y<0){
sy = -sy;
}

x = div1.offsetLeft + sx;
y = div1.offsetTop + sy;
div1.style.left = x +"px";
div1.style.top = y +"px";
}
div1.onmouseover=function(){

clearInterval(timer);
}
div1.onmouseout=function(){
timer = setInterval(startMove,20);
}
div1.onclick=function(){
document.body.removeChild(div1);
div1=null;
}
}
</script>
</head>

<body>
<div class="one">专治不孕不育阳痿早泄</div>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: