jquery 页面循环倒计时

来源:互联网 发布:oracle not like 优化 编辑:程序博客网 时间:2024/06/07 02:50
<html>    <head><script type="text/javascript" src="jquery.js"></script><script type="text/javascript">    function countDown(secs){    var $n1 = $("#n1");// 输出n1的当前坐标var coord = $n1.offset(); var $jumpTo =$("#jumpTo");//alert(jumpTo); $jumpTo.text(secs);  if(--secs>0){       setTimeout("countDown("+secs+")",1000);         }     else{     var offset = $n1.offset( {top: coord.top, left: coord.left+30});     setTimeout("countDown("+3+")",1000);      }     }    </script>     </head>    <body> <span id="jumpTo">3</span>   <p onclick="countDown(3)">test</p><p id="n1" style="width:300px; height: 100px; background-color: red;">111</p>    </body></html>
0 0