yet another preload question

Hi folks, I have read thru and tried some of the various answers for prelaoding images in a page and am missing something, and probably something simple at that.  Nothing complicated here, a sample of the code is:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript1.2">
preLoad1 = new Image();
preLoad1.src = "logo.gif";
</script>
</head>
<body bgcolor="black" onLoad="pageloaded=true;">

  <table width=1000 border=0 cellpadding=0 cellspacing=0>
  <td width=180 align=left valign=top>
    <img src="preLoad.src">
  </td>
  <td valign=middle align=right>

</body>
</html>


I can't figure out the correct reference in the IMG SRC code, basic stuff but my brain is starting to hurt and I have points to give to someone that can show me the errors of my ways.

Thanks,
Bill
GossettBGAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mgfranzConnect With a Mentor Commented:
Remember, just about every page, image, .class file or script is loaded into your cache directory.  Read up on setting <meta> tags for no-cache if you want to not allow files to load into cache.
0
 
GossettBGAuthor Commented:
Edited text of question.
0
 
mgfranzCommented:
Use this;

<SCRIPT LANGUAGE="JavaScript">

<!--
ccImageSrc = new Array (
"image1.jpg", "image2.jpg", "image3.gif", "image4.gif"

)
ccImageList = new Array ();

for (counter in ccImageSrc) {
ccImageList[counter] = new Image();
ccImageList[counter].src =
ccImageSrc[counter];
}
// -->
</SCRIPT>

Insert it in your <head></head> section, change the name of the images to reflect the images you want to pre-load, and your off!

Mark
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
GossettBGAuthor Commented:

What would the reference code for the <IMG SRC=""> look like?  Still can't figure that part out.  Here's the code I'm working with:

<body bgcolor="black" onLoad="pageloaded=true;">

<table width=1000 border=0 cellpadding=0 cellspacing=0>
<td width=180 align=left valign=top>
<img src="preLoad.src">
</td>

</body>
0
 
mgfranzCommented:
No, no, no... you don't need to use <img src=preload.src>.  When the page loads, the function is ran automatically.  you simply call the image as any normal img call;

<table width=1000 border=0 cellpadding=0 cellspacing=0>
<td width=180 align=left valign=top>
<img src=image3.gif>
</td>

</body>

Since the image is already loaded into cache it will open almost instantaniously.
0
 
GossettBGAuthor Commented:
OK, now I see that I was making this more complicated than needed. Mark - your answer is fine, if you re-post it I'll get you the points.  Thanks for the help and explaination.

Bill
0
All Courses

From novice to tech pro — start learning today.