把参数传过去就是了!
例如:
<script type="text/javascript">
var total=0;
function init(val1,val2){
total=val1+val2;
document.getElementById("t1").value=total;
setTimeout("init(total,total)",1000);
}
</script>
<body onload="init(1,1);">
<input type="text" id="t1"/>
</body>
温馨提示:答案为网友推荐,仅供参考