# Java script Preload Gif

**URL:** <https://forum.kirupa.com/t/java-script-preload-gif/42873>\
**Category:** web dev\
**Created:** [February 13, 2004, 11:30pm UTC](https://forum.kirupa.com/t/java-script-preload-gif/42873 "2004-02-13T23:30:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fade\_away](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@Fade\_away](https://forum.kirupa.com/u/Fade_away)\
**Post date:** [February 13, 2004, 11:30pm UTC](https://forum.kirupa.com/t/java-script-preload-gif/42873/1 "2004-02-13T23:30:12Z")

</div>

I found this java script, and what i wanted it to do is preload a GIF i have. the script im talking about is the second one  
[DHTML Kitchen - GIF preloader](http://dhtmlkitchen.com/js/images/preload/index.jsp)

im not excatly sure where im supposed to put the script or how to change their gif to one that i have

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 14, 2004, 1:51am UTC](https://forum.kirupa.com/t/java-script-preload-gif/42873/2 "2004-02-14T01:51:40Z")

</div>

```php
<script type="text/javascript">
   // <![CDATA[
     function loadSnoopy(){
         var snoopyOver = new Image();
         snoopyOver.src = "img/peanuts/snoopyOver.gif"; //<---This is where you want to change the image and path to your image.
     }
   // ]]>
  </script>

<body onload="loadSnoopy()"> //<--- Then replace your page's body tag with this and you should then have your image preloaded

```
