I would like to know if there is a difference between those 2 differents way of using onload() function ? (time delay, order of execution etc.) or is it exactly the same ?
Thanks
1st way :
<iframe onload="frameload()" src="script.php" name="myFrame" id="myFrame"></iframe>
<script>
function frameload(){
var iframe = document.getElementById('myFrame');
var innerDoc = iframe.contentWindow.document;
document.write(innerDoc.getElementById('ele1').value);
}
</script>
2nd way:
<iframe src="script.php" name="myFrame" id="myFrame"></iframe>
<script>
document.getElementById('myFrame').onload=function() {
var iframe = document.getElementById('myFrame');
var innerDoc = iframe.contentWindow.document;
document.write(innerDoc.getElementById('ele1').value);
}
</script>