homepage Welcome to WebmasterWorld Guest from 54.161.197.188
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Code for preload
DreamWeaver code is rather bloated
kapow




msg:1472386
 5:42 pm on Aug 6, 2003 (gmt 0)

I'm using DreamWeaver but its code for things like an image preload is rather bloated.

Can someone tell me a nice short code to get a button and logo to preload e.g. something in the head tad would be good.

 

tedster




msg:1472387
 8:02 pm on Aug 6, 2003 (gmt 0)

Simple image preload:

<script type="text/javascript">

image01=new Image(111,222)
image02=new Image(33,44)

image01.src="logo.png"
image02.src="button.gif"

//-->
</script>

kapow




msg:1472388
 8:56 am on Aug 7, 2003 (gmt 0)

Thanks
Is it ok in the head tag?

korkus2000




msg:1472389
 1:32 pm on Aug 7, 2003 (gmt 0)

Yes that works in the head tag. You could actually put it anywhere, but I believe it will start preloading earlier in the head tag. You could make it a function and add it to your onload event in the body tag if you want preload to start after the page loads. That way your page won't wait to finish loading until the preload is done.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved