2012-09-08 111 views
0

我想SetTimeout並將變量名'MyVAR'返回到timer:function('MyVAR'),我不能這樣做。javascript發送變量到函數

<script type="text/javascript"> 
    var a = function() { 
    function aa(){ 

    } 
    return{ 
     timer: function (MyVAR) { 
     setTimeout("a.timer(MyVAR);", 1000); 
     } 
    } 
    } 
</script> 

回答

2
setTimeout(function() { 
    a.timer(MyVAR); 
}, 1000); 
+0

謝謝蘇......那是沃金! – user1656096