js浮动广告
2006-06-15 13:07
190 查看
<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>
<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>
相关文章推荐
- JS浮动广告脚本
- 听说不错的js 广告浮动
- JS写出登陆遮罩层+浮动对联广告
- JS 浮动广告
- 浮动广告通用JS做法
- JS导航浮动跟踪,浮动广告,跟踪广告代码
- 又一个不错的js浮动广告代码
- 浮动居中js广告插件,支持详细的自定义:最大化播放时长,二次最大化间隔,不显示的url等
- JS实现对联浮动广告(初级)
- 网页上加上 页浮动广告的一段JS就不管用,是doctype的原因
- JS 左右两侧浮动广告
- java/js 右下脚浮动小窗口,慢慢上升,类似于广告窗口
- js浮动广告
- js实现从右向左缓缓浮出网页浮动层广告的方法
- 兼容多浏览器的JS 浮动广告[推荐]
- 网页上加上 页浮动广告的一段JS就不管用,是doctype的原因
- js 浮动div广告(对联广告)
- js 浮动广告代码
- 小小浮动广告js
- JS实现同时存在两个漂浮广告在网页中浮动