[Javascript] image preloading problems

Cutter Bl cutterbl at hotmail.com
Fri Aug 10 12:16:08 CDT 2001


Why preload in this instance?

First of all, I want to thank all of those who helped contribute to me 
working this issue out.

I had a similar issue with the catalog items on my site. I use the 
window.open method like so...

<a href="javascript:void(0)" 
onClick="window.open('itempic.html','1205','toolbar=no,location=no,scrollbars=no,statusbar=no')"><img 
border="1" src="images/1205.sm.jpg" align="left" hspace="5" 
class="clsItemPic" id="1205" alt="Fishing Knife" width="173" 
height="130"></a>

window.open passes three parameters [window.open('1','2','3')] with item 1) 
being the path to the html page to open, item 2) being the window name, and 
item 3) being the attributes.

All of the item images in my catalog have a standard format, 
(itemnumber).(size).jpg [1205.sm.jpg]. I use the Item Number as the window 
name. Since I know that my popup will always display (itemnumber).lg.jpg I 
can then draw the window.name to build my image tag in my popup window. All 
with a single HTML (itempic.html) file like this...

<html>
<head>
	<title>Falcon-Knives</title>

</head>

<body 
onLoad="self.resizeTo(document.imgItemPic.width,document.imgItemPic.height)" 
marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
<script>
document.write("<img src='images/" + window.name + ".lg.jpg' border='0' 
name='imgItemPic'>");
</script>
</html>

Thanks to all who helped with that one (you know who you are)

Cutter
http://www.falcon-knives.com
*************************************
i'm probably going where many have gone before but a google search did not
reveal any obvious problems.

basically i have a two panel image gallery script - entirely
javascript.  the left panel is thumbnails, the right panel is a medium
sized image.  the tricky part is the client wants the user to click on the
medium image to open a new window with the full size image.  the window is
then click-to-close.

i tried preloading the large image but many browsers don't seem to actually
request the image!  the only one that works is ie-win.

i tried writing the window opening code to check to see if the image
properties were set but that doesn't work reliably.  a lot of the time i
get "information not available yet" javascript errors.

is there a way to (a) force the image to load no matter what and (b) wait
until it has fully loaded before proceeding?

here's a short page that illustrates the problem i'm having.

http://www.desertdrama.com/gallery/jsd/bogus.html

-jsd-

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




More information about the Javascript mailing list