<script>
window.onload= function(){
var a = document.getElementById('a');
var b = document.getElementById('ct');
setInterval('b.innerHTML = a.duration',1000);
};
</script>
//Second script
<script>
var a = document.getElementById('a');
var b = document.getElementById('ct');
window.onload= function(){
setInterval('b.innerHTML = a.duration',1000);
};
</script>
为什么第一个脚本不能正常工作?为什么它在document.onload中不起作用?
铬:
Uncaught ReferenceError: b is not defined
你有一个id为'ct'的元素吗?这将导致参考错误... – Tommy 2010-08-12 13:24:12