You are here: irt.org | FAQ | JavaScript | Image | Q726 [ previous next ]
Use the typical image swapping techniques - but the default image to be displayed should be blank, and the image "swap" should be triggered by the onLoad event handler:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
if (document.images) {
nonblank = new Image();
nonblank.src = 'nonblank.gif';
}
function swap() {
if (document.images)
document.images['myImage'].src = nonblank.src;
}
//--></SCRIPT>
</HEAD>
<BODY onLoad="swap()">
<IMG NAME="myImage" SRC="blank.gif" WIDTH="100" HEIGHT="100">
</BODY>
</HTML>