<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>
Why the first script not working ?. Chrome : Uncaught ReferenceError: b is not defined