标题:谁能帮个忙,加一下注释吗?我有些地方看不懂,是飘来飘去的广告的代码
只看楼主
dangdang_198
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2006-4-17
 问题点数:0 回复次数:1 
谁能帮个忙,加一下注释吗?我有些地方看不懂,是飘来飘去的广告的代码

<DIV id=img style="POSITION: absolute"><a href="http://www.sohu.com"><IMG height=120 src="image/6162.gif" width=92 border=0></A></DIV>
<SCRIPT language=JavaScript>
<!-- Begin
var xPos = 20; //层开始时的x坐标
var yPos = document.body.clientHeight; //层开始时的y的坐标,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 start() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
start();

</SCRIPT>

[此贴子已经被作者于2006-12-11 10:27:44编辑过]

搜索更多相关主题的帖子: 广告 var sohu 注释 
2006-12-11 10:26
在编程中沦落
Rank: 2
等 级:新手上路
威 望:4
帖 子:411
专家分:0
注 册:2005-12-25
得分:0 

<DIV id=img style="POSITION: absolute"><a href="650)this.style.width=650;">http://www.sohu.com"><IMG height=120 src="image/6162.gif" width=92 border=0></A></DIV>//定义层,设定层内容,图片大小
<SCRIPT language=JavaScript>
<!-- Begin
/*声明众多变量*/
var xPos = 20; //层开始时的x坐标
var yPos = document.body.clientHeight; //层开始时的y的坐标,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) {//设定条件,如果Y坐标小于0,执行
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {//同样设定假如y坐标大于或等于屏幕高度,则执行
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 start() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
start();

</SCRIPT>


2006-12-11 10:40



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-108729-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.438334 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved