Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

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

irt.org | Knowledge Base | JavaScript | Image | Q1585 [ previous next ]

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

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>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.