function startmarquee(lh, speed, delay, index) {
var t; var p = false; var o = document.getElementById("marqueebox" + index);
o.innerHTML += o.innerHTML;
o.onmouseover = function () {
p = true }
o.onmouseout = function () { p = false }
o.scrollTop = 0;
function start() {t = setInterval(scrolling, speed);
if (!p) { o.scrollTop += 1; }}
function scrolling() {if (o.scrollTop % lh != 0) {o.scrollTop += 1;if (o.scrollTop >= o.scrollHeight / 2)o.scrollTop = 0;
} else {clearInterval(t);setTimeout(start, delay); } }setTimeout(start, delay); }
startmarquee(90, 20, 500, 0);
startmarquee(90, 20, 500, 1);
startmarquee(90, 20, 500, 2);
</script>
<script>
<!--
var speeds = 20; //数字越大速度越慢
var tab = document.getElementById("demo");
var tab1 = document.getElementById("demo1");
var tab2 = document.getElementById("demo2");
tab2.innerHTML = tab1.innerHTML; //克隆demo1为demo2
function Marquee() {
if (tab2.offsetTop - tab.scrollTop <= 0)//当滚动至demo1与demo2交界时
tab.scrollTop -= tab1.offsetHeight //demo跳到最顶端
else {
tab.scrollTop++
}
}
var MyMar = setInterval(Marquee, speeds);
tab.onmouseover = function () { clearInterval(MyMar) }; //鼠标移上时清除定时器达到滚动停止的目的
tab.onmouseout = function () { MyMar = setInterval(Marquee, speeds) }; //鼠标移开时重设定时器
</script>
放在都1网页里面
哪里冲突了
2 个解决方案
#1
从代码上看没冲突,但具体还是要看html的结构
#2
是不是我看错了,第一段 js 少了个 } ?
#1
从代码上看没冲突,但具体还是要看html的结构
#2
是不是我看错了,第一段 js 少了个 } ?