否则将无法滚动
******************************************************************************************/
// 向右不间断滚动
function left(id,w,h,css){
document.write('
');
document.write(document.getelementbyid('$'+id).innerhtml);
document.write(' | |
');
var speed=40
var demo = document.getelementbyid('demo'+id);
var demo1 = document.getelementbyid('demo1'+id);
var demo2 = document.getelementbyid('demo2'+id);
demo2.innerhtml=demo1.innerhtml
var marquee = function(){
demo2.offsetwidth-demo.scrollleft<=0?demo.scrollleft-=demo1.offsetwidth:demo.scrollleft++
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
}
//向左不间断滚动
function right(id,w,h,css){
document.write('
');
document.write(document.getelementbyid('$'+id).innerhtml);
document.write(' | |
');
var speed=40
var demo = document.getelementbyid('demo'+id);
var demo1 = document.getelementbyid('demo1'+id);
var demo2 = document.getelementbyid('demo2'+id);
demo2.innerhtml=demo1.innerhtml
demo.scrollleft=demo.scrollwidth
function marquee(){demo.scrollleft<=0?demo.scrollleft+=demo2.offsetwidth:demo.scrollleft--}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
}
//向上不间断滚动
function up(id,w,h){
document.write('
')
document.write(document.getelementbyid('$'+id).innerhtml)
document.write('
')
var speed=40
var demo = document.getelementbyid('demo'+id)
var demo1 = document.getelementbyid('demo1'+id)
var demo2 = document.getelementbyid('demo2'+id)
demo2.innerhtml=demo1.innerhtml
function marquee(){
demo2.offsettop-demo.scrolltop<=0?demo.scrolltop-=demo1.offsetheight:demo.scrolltop++
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
}
//向下不间断滚动
function down(id,w,h){
document.write('
')
document.write(document.getelementbyid('$'+id).innerhtml)
document.write('
')
var speed=40
var demo = document.getelementbyid('demo'+id)
var demo1 = document.getelementbyid('demo1'+id)
var demo2 = document.getelementbyid('demo2'+id)
demo2.innerhtml=demo1.innerhtml
demo.scrolltop=demo.scrollheight
function marquee(){
demo1.offsettop-demo.scrolltop>=0?demo.scrolltop+=demo2.offsetheight:demo.scrolltop--
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
}