Welcome to WebmasterWorld Guest from 54.147.44.13

Forum Moderators: open

Message Too Old, No Replies

Code for preload

DreamWeaver code is rather bloated

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 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.

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

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 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>

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 0


Thanks
Is it ok in the head tag?
1:32 pm on Aug 7, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member korkus2000 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 20, 2002
posts:3732
votes: 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.