分享

页面上两个飘浮广告的JAVASCRIPT代码

 szanny 2006-11-02

<!-- End ImageReady Slices -->
<div id="img" style="position:absolute;">
<a href="news_view.asp?newsid=48"; target="_blank">
<img src="images/action01.gif "; border="0"></a>
</div>

<script language="javascript" type="text/javascript">
<!--
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon=0;
var pause = true;
var interval;
img.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.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 www_helpor_net() {
img.visibility = "visible";
interval = setInterval(‘changePos()‘, delay);
}
www_helpor_net();
//
-->
</script>
<!-- End ImageReady Slices -->
<div id="img1" style="position:absolute;">
<a href="news_view.asp?newsid=51"; target="_blank">
<img src="images/cushaw.jpg "; border="0"></a>
</div>

<script language="javascript" type="text/javascript">
<!--
var xPos1 = 120;
var yPos1 = document.body.clientHeight;
var step1 = 2;
var delay1 = 130;
var height1 = 50;
var Hoffset1 = 50;
var Woffset1 = 50;
var yon1 = 50;
var xon1=50;
var pause1 = true;
var interval1;
img1.style.top = yPos1;
function changePos1() {
width1 = document.body.clientWidth;
height1 = document.body.clientHeight;
Hoffset1 = img1.offsetHeight;
Woffset1 = img1.offsetWidth;
img1.style.left = xPos1 + document.body.scrollLeft;
img1.style.top = yPos1 + document.body.scrollTop;
if (yon) {
yPos1 = yPos1 + step1;
}
else {
yPos1 = yPos1 - step1;
}
if (yPos1 < 0) {
yon1 = 1;
yPos1 = 0;
}
if (yPos1 >= (height1 - Hoffset1)) {
yon1 = 0;
yPos1 = (height1 - Hoffset1);
}
if (xon1) {
xPos1 = xPos1 + step1;
}
else {
xPos1 = xPos1 - step1;
}
if (xPos1 < 0) {
xon1 = 1;
xPos1 = 0;
}
if (xPos1 >= (width1 - Woffset1)) {
xon1 = 0;
xPos1 = (width1 - Woffset1);
}
}
function www_helpor_net1() {
img1.visibility = "visible";
interval1 = setInterval(‘changePos1()‘, delay);
}
www_helpor_net1();
//
-->
</script>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多