我想在DW中做一个效果就是图片随鼠标的向下滚动而滚动
发布网友
发布时间:2023-11-11 19:03
我来回答
共1个回答
热心网友
时间:2024-12-14 18:54
这个简单:
<SCRIPT LANGUAGE="JavaScript">
<!--
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 20);
}
document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src=images/888888.jpg></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><img src=images/888888.jpg></div>");
initEcAd()
//-->
</SCRIPT>
加在<body></body>之间
你也可以把他弄成一个单独的网页,然后js调用他.不上自学的.可能前面说的不正确.不知道你理解我的意思没有.
看一下里面的代码.高度什么的都能该.图片也能改.