2012-01-04 64 views

回答

0

嘗試分配勞斯萊斯對象到一個全局變量,然後觸發啓動/停止它。

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <script src="jquery-1.7.1.min.js" type="text/javascript"></script> 
    <script src="jquery.marquee.js" type="text/javascript"></script> 
    <script> 
    var marque; 
    $(function() { 

     marque= $('div.demo marquee').marquee('pointer'); 
    }); 

    function startmqr() { 
     $(marque).trigger('start'); 
    } 
    function stop() { 
     $(marque).trigger('stop'); 
    } 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div class="demo"> 
     <h2> 
      Vanilla</h2> 
     <pre><code>&lt;marquee behavior="scroll" scrollamount="1" direction="left" width="350"&gt;</code></pre> 
     <marquee behavior="scroll" direction="left" scrollamount="2" width="350"><p>START Lorem ipsum dolor sit amet END</p></marquee> 
    </div> 
    <input id="Button1" type="button" value="start" onclick="startmqr()" /> 
    <input id="Button2" type="button" value="stop" onclick="stop()" /> 
    </form> 
</body> 
</html> 

問候