Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1585 Is there a way to control the order in which images load?

You are here: irt.org | FAQ | JavaScript | Image | Q1585 [ previous next ]

Try:

<html>

<head>

<script language="JavaScript"><!--
var theImage = new Array('im1.gif','im2.gif','im3.gif');
var loaded = false;

function loadNext(imageName, image2Load) {
   if (!document.images || !loaded) return; // images not supported
   document.images[imageName].src = theImage[image2Load];
}
//--></script>

</head>

<body onLoad="loaded=true; loadNext('image0',0);">
<IMG SRC="blank.gif" NAME="image0" onLoad="loadNext('image1',1);">
<IMG SRC="blank.gif" NAME="image1" onLoad="loadNext('image2',2);">
<IMG SRC="blank.gif" NAME="image2">
</body>

</html>

©2018 Martin Webb