Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Image PreLoad


  • From: flavio at economisa.com.br (Flávio Gomes)
  • Subject: [Javascript] Image PreLoad
  • Date: Thu Sep 21 13:38:14 2006

myPreload = document.createElement("img");

//myPreload.src = "http://www.google.com/intl/en/images/logo.gif";;

// A couple of large images to test

//myPreload.src = "http://www.plantzafrica.com/vegetation/vegimages/funderstoreyzululand.jpg";;

myPreload.src = "http://www.forestserviceni.gov.uk/our_forests/forests/east%20district/images/belvoir/belvoir_1.jpg";;

myPreload.onload = function() { alert(" I'm Loaded! ");               //Fires on onload
                                document.body.appendChild(myPreload); //Append the image to the document
                                alert(" Here I am! ");                //Says "Hello"? =)
                                this.onload = "";                     // BUG FIX HERE
                              };



People please test this code for me?
On my Mozilla the onload event kept on spamming all the time...


Terry Riegel escreveu:

> Sorry, I was unclear in my original post. I would like to preload an  
> image and fire an event once it is loaded. Is this possible?
>
> Terrry
>
>
> On Sep 21, 2006, at 11:49 AM, Fl?vio Gomes wrote:
>
>> myPreload = document.createElement("img");
>>
>> myPreload.src = "http://www.google.com/intl/en/images/logo.gif";;
>>
>>
>> Maybe this would work too:
>> <img src="http://www.google.com/intl/en/images/logo.gif"; width="0">
>>
>> Both untested =)
>>
>> Terry Riegel escreveu:
>>
>>> Hello All,
>>>
>>> What is a good way to preload a single image?
>>>
>>> Terry
>>> _______________________________________________
>>> Javascript mailing list
>>> Javascript@xxxxxxxxxx
>>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>>
>>
>> -- 
>> Flavio Gomes
>> flavio@xxxxxxxxxxxxxxxx
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript


-- 
Flavio Gomes
flavio@xxxxxxxxxxxxxxxx