<div onclick="ss(this)" style=" height:100px; width:100px; background-color:#000066"></div>
<script>
var timer = ""
function ss(obj){
 //*****要执行的xx
 timer = setTimeout(function(){ss(obj)},1000)   //这里的obj未定义
}
</script>

解决方案 »

  1.   

    <div onclick="ss(this)" style=" height:100px; width:100px; background-color:#000066"></div>
    <script>
    var timer = "";
    var global_obj = null;
    function ss(obj){
     global_obj = obj;
     //*****要执行的xx
     timer = setTimeout("ss(global_obj)",1000)   //这里的obj未定义
    }
    </script>
      

  2.   

    你试下<div onclick="ss(this)" style=" height:100px; width:100px; background-color:#000066"></div>
    <script>
    var timer = ""
    function ss(obj){
     //*****要执行的xx
    alert(obj);
     timer = setTimeout("ss('"+obj+"')",1000);   //这里的obj未定义
    }
    </script>
      

  3.   


    setTimeout(function(){ss(obj)},1000)
    setTimeout 执行的方法不能带参数,如果要带入参数需要封装在一个方法中