<!DOCTYPE HTML>
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
 </head>
 <body>
  <script>
function Pause(s,f){ 
    this.GoOn = function(n,s){
        if(n == 0){ 
            setTimeout(function(){GoOn(1,s);},s);
        } else{ 
            f();
        } 
    }
    this.GoOn(0,s);
}
function testMethod(){
    alert("等待5秒");
    Pause(5000,function(){
        alert("结束!");
    });
}
</script>
<a onclick="testMethod();">开始</a>
</body>
</html>
原文:http://www.cnblogs.com/zhangrumingbj/p/3884647.html