哪位哥哥,能帮我写一个demo呀.一个"按钮"和一个"DIV"初始的时候是在一个div里面一直输出字符 A然后 当鼠标指着"按钮"的时候,DIV里面的文字暂停输出;然后 鼠标 离开"按钮"的时候又继续输出

解决方案 »

  1.   


    <script type="text/javascript">
      <!--
        var t="";
    function Start(){
    var g = document.getElementById("g")

    g.innerHTML +="A" 
    t = setTimeout("Start()",1000)
    }
    function Stop(){
    clearTimeout(t)
    }
    window.onload=function(){
    Start();
    var go = document.getElementById("go")
    go.onmouseover =function(){
    Stop();
    //alert("x")
    }
    go.onmouseout =function(){
    Start();
    }
    }
      //-->
      </script>
     </head> <body>
      <div id="g"></div>
      <input type="button" value="Let's Go" id="go">
     </body>
      

  2.   


    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无题</title>
    </head>
    <body><button onmouseover="test.isue()" onmouseout="test.rere()">我不是按钮</button><div id="div1"></div><script>
    var test = {};
    test.timer = null;
    test.interval = 300;test.helpme = function (){
        var obj = document.getElementById('div1');
        obj.innerHTML += 'A';
    }test.timer = setInterval(test.helpme,test.interval);test.isue = function (){
        clearInterval(test.timer);
    }test.rere = function (){
        test.timer = setInterval(test.helpme,test.interval);
    }
    </script>
    </body>
    </html>