Your browser does not seem to support CSS. If images appear below, please disregard them.
It appears that you're running an Ad-Blocker. This site is monetized by Advertising and by User Donations; we ask that if you find this site helpful that you whitelist us in your Ad-Blocker, or make a Donation to help aid in operating costs.
Previous Thread
Next Thread
Print Thread
Rate This Thread
#18569 - 10/16/02 03:53 AM preload images  
Joined: Apr 2002
Posts: 730
Moffesto Offline
UGN Supporter
Moffesto  Offline
UGN Supporter

Joined: Apr 2002
Posts: 730
Kuntucky
Is there a html script or javascript that i could use to preload the images on a webpage?


2 people can keep a secret as long as one is dead
Sponsored Links
#18570 - 10/16/02 10:22 AM Re: preload images  
Joined: Oct 2002
Posts: 21
Energy Offline
Junior Member
Energy  Offline
Junior Member

Joined: Oct 2002
Posts: 21
D you mean how do you specify the height and width of an image so the page, as it loads, knows how to place the text? If so the html syntax is:

My Image

The 48 is in pixels.

A nice link is
http://www.devguru.com for many web coding questions.

#18571 - 10/17/02 01:45 AM Re: preload images  
Joined: Apr 2002
Posts: 730
Moffesto Offline
UGN Supporter
Moffesto  Offline
UGN Supporter

Joined: Apr 2002
Posts: 730
Kuntucky
I mean... you know how the html loads first and then it takes time to load the pictures after... and for me (on a 24k connection) it takes forever to load the pictures. I'd like for the pictures to be preloaded so everythign loads at once, i know it will take just as long to load but id b a nice feature. if you know what i mean... im not a very good explainer.


2 people can keep a secret as long as one is dead
#18572 - 10/17/02 06:26 AM Re: preload images  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
in javascript it is....

Code:
<HEAD>

<SCRIPT language="JavaScript">

Image1= new Image(200,200)
Image1.src = "image.gif"

Image2= new Image(340,200)
Image2.src = "coolpic.jpg"

</SCRIPT>

</HEAD>

  
I think thats pretty much self explanitory. The variable name you use is irrelevant because you don't use that to call the image. You still put the image on your page like normal, this code just brings it into the cache before hand for a fast load. Think thats what you wanted.


"It's better to burn out, than to fade away."
#18573 - 10/18/02 03:17 AM Re: preload images  
Joined: Oct 2002
Posts: 37
ReverendNinjaSox Offline
Junior Member
ReverendNinjaSox  Offline
Junior Member

Joined: Oct 2002
Posts: 37
I do mine in an extremely complex and dynamic manner. If you are doing yours dynamically as well. You may want to think about doing something like this.
Create a javascript function that looks similar to this.
Code:
function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
That is my javascript function. Then I proceed to call it like this.

Code:
<body onLoad="MM_preloadImages('image1.jpg','image2.jpg','image3.jpg');"
Doing this makes it really easy to dynamically specify all the images you are going to need.

Sponsored Links
#18574 - 10/21/02 02:42 AM Re: preload images  
Joined: Apr 2002
Posts: 730
Moffesto Offline
UGN Supporter
Moffesto  Offline
UGN Supporter

Joined: Apr 2002
Posts: 730
Kuntucky
i dont know shit about javascript... i can just configure it alil but other than that... im lost. Do u put the first part in the head and the second in the body or what?


2 people can keep a secret as long as one is dead
#18575 - 10/21/02 11:44 AM Re: preload images  
Joined: Oct 2002
Posts: 37
ReverendNinjaSox Offline
Junior Member
ReverendNinjaSox  Offline
Junior Member

Joined: Oct 2002
Posts: 37
For mine? You'd just do what BackSlash did up there at first with the head and javascript tags. Then the body part would go with the body tag.

#18576 - 10/21/02 07:39 PM Re: preload images  
Joined: Mar 2002
Posts: 599
BackSlash Offline
UGN's Resident Homo
BackSlash  Offline
UGN's Resident Homo

Joined: Mar 2002
Posts: 599
TN
mines easier :p


"It's better to burn out, than to fade away."
#18577 - 10/22/02 04:18 PM Re: preload images  
Joined: Oct 2002
Posts: 37
ReverendNinjaSox Offline
Junior Member
ReverendNinjaSox  Offline
Junior Member

Joined: Oct 2002
Posts: 37
Not if you are making it dynamic!

#18578 - 11/05/02 11:11 PM Re: preload images  
Joined: Mar 2002
Posts: 143
olosoft Offline
Member
olosoft  Offline
Member

Joined: Mar 2002
Posts: 143
.
uhh, yes, because you wrote that code yourself ReverendNinjaSox. its not at all the code that macromedia dreamweaver generates for you. MM_preloadImages. *sigh*

Sponsored Links
#18579 - 11/06/02 06:38 PM Re: preload images  
Joined: Oct 2002
Posts: 37
ReverendNinjaSox Offline
Junior Member
ReverendNinjaSox  Offline
Junior Member

Joined: Oct 2002
Posts: 37
Oo. Good call. I didn't do the javascript. I do the perl that lies behind it.


Member Spotlight
Gremelin
Gremelin
Portland, OR; USA
Posts: 7,195
Joined: February 2002
Show All Member Profiles 
Forum Statistics
Forums45
Topics46,786
Posts81,956
Average Daily Posts11
Members2,159
Most Online1,567
Apr 25th, 2010
Latest Postings
Top Posters(All Time)
UGN Security 39,950
Gremelin 7,195
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Liked Users (All Time)
§intå× Likes: 1
Cold Sunn Likes: 1
Crime Likes: 1
Cyrez Likes: 1
Ghost Likes: 1
Gremelin Likes: 4
Ice Likes: 1
unreal Likes: 1
Top Liked Users (30 Days)
Powered by UBB.threads™ PHP Forum Software 7.6.0
(Snapshot build 20160902)