Solved

page loading in correct order

Posted on 2001-06-19
7
168 Views
Last Modified: 2010-04-25
Hi Folks,
Please take a look here
http://perso.libertysurf.co.uk/roryjac/epsilon.htm
This is part of a course that i am doing. I cannot get the images to load in the correct order.
As you will see the image that i would like to load first always loads last.
Any help would be appreciated.
thanks
Rorf
0
Comment
Question by:rorf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 2

Expert Comment

by:sherly
ID: 6209628
Which image you would like to load first?
0
 

Author Comment

by:rorf
ID: 6211418
Sorry
the image that needs to load first is:
800load.jpg
It always loads last. It was the last image added to the page as instructed by my tutor.
Even he is stumped.
Thanks
Rorf
0
 

Author Comment

by:rorf
ID: 6239431
Please someone help me
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 7

Expert Comment

by:ClassyLinks
ID: 6242970
have you tried preloading it??
0
 
LVL 2

Expert Comment

by:sherly
ID: 6243755
Why not make page to load the 800load.jpg first and then redirect to  another page?
0
 

Accepted Solution

by:
jastroem earned 50 total points
ID: 6244699
I don't think that you can control in which order the images are loaded(?) What you could do is to preload them on a previous page. Even better would be to preload them and have an auto redirect to the page where the images should be displayed when the images have been loaded.

you can use this code for that:

//// Put this Script somewhere between <head> </head>

<script language="javascript">
<!--
function initArray() {
 this.length = initArray.arguments.length;
 for (var i = 0; i < this.length; i++) {
  this[i] = initArray.arguments[i];
 }
}

 var pics = new initArray(
 "images/menueimages/botright.jpg",
 "images/menueimages/center.jpg"

//just fill up with images here that you want to preload - the last one without comma ,


 

function transfer(param) {
  location.href = "index-sub.htm"; // URL of second page goes here **
}
// *************************************************************

function done() {
 if (vers < 1.1)
  transfer();
 else
  commence_loading();
}

function commence_loading() {
 for (g=0;g<pics.length;g++)
  eval('document.preload'+g+'.src = "'+pics[g]+'";');
}

// preload the status bar images
// make yourself two GIF's blue.gif and black.gif
// to use for the success bar
if (vers >= 1.1) {
 blue = new Image();
 blue.src = "blue.gif";
 black = new Image();
 black.src = "black.gif";
}

var loaded = new initArray(0);
for (h=0;h<pics.length;h++)
 loaded[h] = 0;
num_loaded = 0;

function update(num) {
 loaded[num]++;
 if (loaded[num] == 2) {
  if (vers < 1.1)
   document.stats.status.value += "||";
  else
   eval('document.status'+num_loaded+'.src = "blue.gif";');
  num_loaded++;
  if (num_loaded == pics.length)
   transfer();
 }
}
// -->
</script>


/////// Put this code somewhere between <body> and </body>

<script language="JavaScript">
<!--
if (vers < 1.1) {
 document.write('What a pitiful browser you have! Get Netscape 3 or above '
  + 'to see all the great stuff on this site.<br><br><br><br><br><br>');
 for (j=0;j<pics.length;j++) {
  document.write('<img src="'+pics[j]+'" width=1 height=1>');
 }
} else {
 document.write('<table align="center"><tr><td align="center">'
  + '<img src="blue.gif" width=10 height=10>');
 for (k=0;k<pics.length;k++)
  document.write('<img src="black.gif" width=15 height=10 name="status'+k+'">');
 document.write('</td></tr></table><br><br><br><br><br><br><br><br>');
 for (j=0;j<pics.length;j++) {
  document.write('<img src="black.gif" width=1 height=1 '
   + 'onLoad="update('+j+')" name="preload'+j+'">');
 }
}
// -->
</script>

I'm not an javascript expert... but I have used this for a site, and it works just fine. But you must make yourself two small GIF's 10 x 10 pixel large, and currently the way the script looks right now these images should be in the same directory as the page itself.

/ Joergen

0
 

Author Comment

by:rorf
ID: 6260452
Thanks jastroem  for your help.
sorry i took so long to answer, ive been away on holiday.
regards
rory
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question