关闭

js浮动广告

标签: delayfunctionjavascriptdiv
877人阅读 评论(0) 收藏 举报
分类:
<DIV id=wcimg style="POSITION: absolute">aaaaaaa</DIV>
<SCRIPT language=javascript>
<!--
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 10;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var wcinterval;
wcimg.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = wcimg.offsetHeight;
Woffset = wcimg.offsetWidth;
wcimg.style.left = xPos + document.body.scrollLeft;
wcimg.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function wcstart() {
wcimg.visibility = "visible";
wcinterval = setInterval('changePos()', delay);
}
wcstart();
// End -->
</SCRIPT>
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:127324次
    • 积分:1712
    • 等级:
    • 排名:千里之外
    • 原创:35篇
    • 转载:54篇
    • 译文:0篇
    • 评论:16条
    最新评论