Why it not work in document.onload?
<pre><code>&lt;script&gt;
window.onload= function(){
var a = document.getElementById('a');
var b = document.getElementById('ct');
setInterval('b.innerHTML = a.duration',1000);
};
&lt;/script&gt;
//Second  script
&lt;script&gt;
var a = document.getElementById('a');
var b = document.getElementById('ct');
window.onload= function(){
setInterval('b.innerHTML = a.duration',1000);
};
&lt;/script&gt;
</code></pre>

<p>Why the first script not working ?. Chrome : Uncaught ReferenceError: b is not defined</p>
