marquee简单掉
onmouseover="this.stop"

解决方案 »

  1.   


    设一个标志变量,
    var scrollFlag=0;
    当鼠标移入div时置成1,
    onmouseover='scrollFlag=1'
    当鼠标移开div时置成0,
    onmouseout='scrollFlag=0'然后在你的div滚动时,判断scrollFlag的值即可。
      

  2.   

    为了测试我加了几个小笑话。  
    注意有
    /////////// ················///////////
    的地方添加一个变量scrollFlag,和两个函数:eMouseover  eMouseout代码如下:<span style='visibility:hidden;'>
    <span id="pm1">
    公园小路上,男正对女发誓。
    男:我爱你,直到大海干枯。
    女:不行,冰川期到时,海平面回下降。
    男:我爱你,直到地球毁灭。
    女:不行,一颗慧星撞过来,地球就没了。
    男:我爱你,直到中国电信实行手机单向收费!
    女:太美了。
    接吻声————————————————————
    </span>
    <span id="pm2">
    傻女婿从前有个傻女婿。
    有一天他岳父要来拜访,父亲刚好要出远门,不放心,所以就教他,
    如果你岳父问你:"这些院子的牛马是怎麽照顾的,长得这麽好。"
    你就说:"小小畜牲何必介意!"
    如果他问你:"家中事业是谁在管理的?"
    你就说:"小婿无能父亲掌管!"
    如果问起墙上那幅画,就说:"这是唐伯虎名画。"
    还叫他覆颂了一遍,才放心离开。
    </span>
    <span id="pm3">
    有一名贵妇养了一只母鹦鹉,但这只鹦鹉只会说:「来ㄚ!要不要爽一下ㄚ......」
    贵妇觉的这鹦鹉的行为实在有辱她的身份有日贵妇看到对面教堂的神父也养了一只公鹦鹉,而且很乖的在笼子里祷告
    於是便去请教神父:「为何你的鹦鹉那麽乖?养多久啦?
    我把我家的鹦鹉给你调教好吗?」神父:「我养两年啦,它ㄧ直都很乖,你的鹦鹉怎麽啦?」
    </span>
    <span id="pm4">
    儿子提著一个很大的提包,对爸爸说:「这个家我再也忍受不下去<BR>了。我要离开,我要自己去过那种天天有刺激,天天花天酒地,<BR>天天有漂亮妹妹的生活。爸爸,你无论如何都不能阻挠我。」<BR>爸爸一听,急急忙忙的说:「谁会阻挠你呀,我马上准备行李跟<BR>你一起去。」<BR>
    </span>
    </span>
    <SCRIPT language=JavaScript1.2>
    /////////// ················///////////
    var scrollFlag=1;var scrollerwidth=568
    var scrollerheight=150
    var scrollerbgcolor=''//set below to '' if you don't wish to use a background image
    var scrollerbackground='images/n_img/index_meuu_12.jpg'//configure the below variable to change the contents of the scroller
    var messages=new Array()
    messages[0]=pm1.innerHTML
    messages[1]=pm2.innerHTML
    messages[2]=pm3.innerHTML
    messages[3]=pm4.innerHTML
    ///alert(messages[0]);
    ///////Do not edit pass this line///////////////////////if (messages.length>1)
    i=2
    else
    i=0function move1(whichlayer){tlayer=eval(whichlayer)if (tlayer.top>0&&tlayer.top<=5){
    tlayer.top=0
    setTimeout("move1(tlayer)",3500)
    setTimeout("move2(document.main.document.second)",3500)
    return
    }
    if (tlayer.top>=tlayer.document.height*-1){
    /////////// ················///////////
    if(scrollFlag==1)tlayer.top-=5
    setTimeout("move1(tlayer)",100)
    }
    else{
    tlayer.top=scrollerheight
    tlayer.document.write(messages[i])
    tlayer.document.close()
    if (i==messages.length-1)
    i=0
    else
    i++
    }}function move2(whichlayer){tlayer2=eval(whichlayer)
    if (tlayer2.top>0&&tlayer2.top<=5){
    tlayer2.top=0
    setTimeout("move2(tlayer2)",3500)
    setTimeout("move1(document.main.document.first)",3500)
    return
    }
    if (tlayer2.top>=tlayer2.document.height*-1){
    /////////// ················///////////
    if(scrollFlag==1)tlayer2.top-=5
    setTimeout("move2(tlayer2)",100)
    }
    else{
    tlayer2.top=scrollerheight
    tlayer2.document.write(messages[i])
    tlayer2.document.close()
    if (i==messages.length-1)
    i=0
    else
    i++
    }}function move3(whichdiv){tdiv=eval(whichdiv)
    if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5){
    tdiv.style.pixelTop=0
    setTimeout("move3(tdiv)",3500)
    setTimeout("move4(second2)",3500)
    return
    }
    if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1){
    /////////// ················///////////
    if(scrollFlag==1)tdiv.style.pixelTop-=5
    setTimeout("move3(tdiv)",100)
    }
    else{
    tdiv.style.pixelTop=scrollerheight
    tdiv.innerHTML=messages[i]
    if (i==messages.length-1)
    i=0
    else
    i++
    }}function move4(whichdiv){tdiv2=eval(whichdiv)
    if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5){
    tdiv2.style.pixelTop=0
    setTimeout("move4(tdiv2)",3500)
    setTimeout("move3(first2)",3500)
    return
    }
    if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1){
    /////////// ················///////////
    if(scrollFlag==1)tdiv2.style.pixelTop-=5
    setTimeout("move4(second2)",100)
    }
    else{
    tdiv2.style.pixelTop=scrollerheight
    tdiv2.innerHTML=messages[i]
    if (i==messages.length-1)
    i=0
    else
    i++
    }}function startscroll(){if (document.all){
    move3(first2)
    second2.style.top=scrollerheight
    second2.style.visibility='visible'
    }
    else if (document.layers){
    document.main.visibility='show'
    move1(document.main.document.first)
    document.main.document.second.top=scrollerheight+5
    document.main.document.second.visibility='show'
    }}window.onload=startscroll
    /////////// ················///////////
    function eMouseover()
    {
       scrollFlag=0;
    }
    /////////// ················///////////
    function eMouseout()
    {
       scrollFlag=1;
    }</SCRIPT>
    <SCRIPT language=JavaScript1.2>
    if (document.layers)
    document.write(messages[0])
    </SCRIPT><SCRIPT language=JavaScript1.2>
    if (document.layers)
    document.write(messages[1])
    </SCRIPT>
    <SCRIPT language=JavaScript1.2>
    if (document.all){
    /////////// ················///////////
    document.writeln('<span id="main2" onmouseover="eMouseover();"  onmouseout="eMouseout();" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hiden;background-color:'+scrollerbgcolor+' ;background-image:url('+scrollerbackground+')">')
    document.writeln('<div  style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0;top:0" > ')
    document.writeln('<div  id="first2" style="position:absolute;width:'+scrollerwidth+';left:0;top:1;">')
    document.write(messages[0])
    document.writeln('</div>')
    document.writeln('<div  id="second2" style="position:absolute;width:'+scrollerwidth+';left:0;top:0;visibility:hidden">')
    document.write(messages[1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</span>')
    }
    </SCRIPT>