Forum Moderators: open
Assuming you don't want to just place the <div> at the end of your page code, you may be able to select the largest image (in filesize) and place an onload event in its tag, i.e. <img src="huge.jpg" onload="writeDiv()">
Depending on the browser, placing the onload event in the BODY tag may produce the results you seek.
In extreme cases, you can set an incrementing variable in each image AND in the BODY, and then set a timer to check to see that the incrementing variable is at the point that says "done", THEN run a script that writes the <div>.
<script>
incrementer=0;
chkLoaded=setTimeout("chkIncrement()",100);
function chkIncrement() {
if (incrementer==3) {
clearTimeout(chkLoaded);
writeDiv();
}
}
</script>
<body onload="incrementer++">
<img src="pic1.gif" onload="incrementer++">
<img src="pic2.gif" onload="incrementer++">
</body>
As each element (body,pic1,pic2) loads, it updates the incrementer. Every 1/10th of a second the status of the incrementer is checked. When it hits 3 (the total number of page elements including the page) it stops the 1/10th of a second check and triggers the <div> writing function.