<body>
<div id='sss'></div>
<script>
function $my(Id){return document.getElementById(Id);}
function countDown(obj1, count) 

  this.obj = obj1; 
  this.ss = count; 
  this.mm = this.ss % 60; 
  this.tt = parseInt(this.ss / 60); 
  this.m = this.tt % 60; 
  this.h = parseInt(this.ss / 3600);  
  this.show = function(delegate) { 
                if (delegate) { 
                    delegate(this); 
                } 
            } 
} function countDownTest(o)// 倒计时 

  o.mm-- ; 
  if(o.mm < 0) 
  { 
      if(o.m > 0) 
      { 
        o.mm = 59; 
        o.m -- ; 
      } 
      else if(o.m == 0 && o.h > 0) 
      { 
        o.mm = 59; 
        o.m = 59; 
        o.h -- ; 
      } 
      else if(o.m == 0 && o.h == 0) 
      { 
        return; 
      } 
  } 
  var str = ""; 
  if(o.h < 10) str = "0" + o.h; 
  else str = o.h; 
  str += " : "; 
  if(o.m < 10) str += "0" + o.m; 
  else str += o.m; 
  str += " : "; 
  if(o.mm < 10) str += "0" + o.mm; 
  else str += o.mm; 
  o.obj.innerHTML = str; 
  //alert(o.obj); 
setTimeout(function(){countDownTest(ss)}, 1000); 
} var ss = new countDown($my('sss'),30*60*60)
//for(var i in ss)
//{alert(i);alert(ss[i]);}
setTimeout(function(){countDownTest(ss)}, 1000);
</script>
</body>

解决方案 »

  1.   

    =====
    countDownTest 里的参数
      

  2.   

    setTimeout("countDownTest("+o+")", 1000); 
    改成
    setTimeout("eval('countDownTest(o)');", 1000); 
      

  3.   

    如果你O是 全局变量的话,好像直接写就可以了啊不用那么复杂吧?setTimeout("countDownTest(o)", 1000); 
      

  4.   

    哪有这么麻烦的使用方法,告诉你一个简单的
    setTimeout(function(){func("fff");},1000)这样就行了,根本不需要引号,免得糊涂