发布网友 发布时间:2022-04-23 09:10
共2个回答
热心网友 时间:2022-04-20 12:55
<!------------------ 向左滚动代码开始 -------------------------->
<div id=demo style="overflow:scroll;height:93;width:600;background:#214984;color:#ffffff" >
<table align=left cellpadding=0 cellspacing=0 border=0>
<tr>
<td id=demo1 valign=top><img src="1-1.jpg" width="102" height="77" border="0" /><img src="2-1.jpg" width="102" height="77" border="0" /><img src="3-1.jpg" width="102" height="77"border="0" /><img src="4-1.jpg" width="102" height="77"border="0" /><img src="5-1.jpg" width="102" height="77"border="0" /><img src="6-1.jpg" width="102" height="77"border="0" /></td>
<td id=demo2 valign=top"></td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed=30 //速度(单位:毫秒,1秒=1000毫秒)
demo2.innerHTML=demo1.innerHTML //将第二个储存格的空内容使用和第一格一样的内容填充
function Marquee(){
if(demo1.offsetWidth-demo.scrollLeft<=0) //假如图片走到第一个储存格完
demo.scrollLeft-=demo2.offsetWidth // 这时候重新从第一格第一张图片开始走动
else{ //否则
demo.scrollLeft++ // 滚动条一直向左滚动
}
}
var MyMar=setInterval(Marquee,speed) //以时间speed为间隔逐次调用滚动条函数
demo.onmouseover=function() {clearInterval(MyMar)} //鼠标放上的时候解除对滚动函数的调用
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}//移开则重新调用滚动函数
</script>
<!------------------ 向右滚动代码开始 -------------------------->
<div id=demoRight style="overflow:hidden;height:77;width:600;background:#000000;color:#ffffff;border:5px none #000000;">
<table align=left cellpadding=0 cellspacing=0 border=0>
<tr>
<td id=demoRight1 valign=top><img src="1-1.jpg" width="102" height="77" border="0" /><img src="2-1.jpg" width="102" height="77" border="0" /><img src="3-1.jpg" width="102" height="77"border="0" /><img src="4-1.jpg" width="102" height="77"border="0" /><img src="5-1.jpg" width="102" height="77"border="0" /><img src="6-1.jpg" width="102" height="77"border="0" /><img src="7-1.jpg" width="102" height="77"border="0" /><img src="8-1.jpg" width="102" height="77" border="0" /></td>
<td id=demoRight2 valign=top></td>
</tr>
</table>
</div>
<script type="text/javascript">
var speed_Right=30
demoRight2.innerHTML=demoRight1.innerHTML
demoRight.scrollLeft = demoRight1.offsetWidth
function Marquee_Right(){
if(demoRight.scrollLeft<=0)
demoRight.scrollLeft+=demoRight1.offsetWidth
else{
demoRight.scrollLeft--
}
}
var MyMar_Right=setInterval(Marquee_Right,speed_Right)
demoRight.onmouseover=function(){clearInterval(MyMar_Right)}
demoRight.onmouseout=function() {MyMar_Right=setInterval(Marquee_Right,speed_Right)}
</script>
热心网友 时间:2022-04-20 14:13
看不懂,太乱了,全是错误。把我的给你自己看下,
---------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>
</p>
<script src="js/ad-01.js" language="JavaScript"></script>
</body>
</html>
<script>
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 = 100;// 左侧广告距离页首高度
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 = 100;// 右侧广告距离页首高度
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'><a href='http://www.makewing.com/lanren' target='_blank'><img src=images/ad-01.gif border='0'></a></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><a href='http://www.makewing.com/lanren' target='_blank'><img src=images/ad-01.gif border='0'></a></div>");
initEcAd()
// JavaScript Document
</script>