Javascript 关于浮动窗口
本来做好的浮动床口能在页面上动,可是和别的网页结合的时候路径就出问题了,我想知道我应该调哪些参数和属性?我的广告浮动窗口大小为w150*h100网页为w1000*h120...
本来做好的浮动床口能在页面上动,可是和别的网页结合的时候路径就出问题了,我想知道我应该调哪些参数和属性?我的广告浮动窗口大小为w150*h100
网页为w1000*h1200的,我想让窗口在w600*h1000之间活动.
本人只有50十分了想全部送上,但系统不让,等我解决问题的时候会追加分的! 展开
网页为w1000*h1200的,我想让窗口在w600*h1000之间活动.
本人只有50十分了想全部送上,但系统不让,等我解决问题的时候会追加分的! 展开
2个回答
展开全部
<div id="img" style="position:absolute; z-index=99;z-index: 1000;">
<a href="http://www2.wznc.zj.cn/physics/tuanxue/yxbys/yanjing.htm"><img src="http://www2.wznc.zj.cn/physics/tuanxue/images/fei.jpg" onClick="pause_resume();" border="0" alt='img' > </a>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var xPos = document.body.clientWidth-20;
var yPos = document.body.clientHeight/2;
var step = 1;
var delay = 5;
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);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
// End -->
</script>
<a href="http://www2.wznc.zj.cn/physics/tuanxue/yxbys/yanjing.htm"><img src="http://www2.wznc.zj.cn/physics/tuanxue/images/fei.jpg" onClick="pause_resume();" border="0" alt='img' > </a>
</div>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var xPos = document.body.clientWidth-20;
var yPos = document.body.clientHeight/2;
var step = 1;
var delay = 5;
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);
}
function pause_resume() {
if(pause) {
clearInterval(interval);
pause = false;
}else {
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
// End -->
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询