|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
Can someone help me in javascript with preloading images. I am using a template and I want to preload the images for each page. Here is an exemple of a page : Andrée Roy | Artiste-peintre What I did as a compromise is to have the images preload in the index.htm. Andrée Roy | Artiste peintre | Décoratrice But if someone gets to the site without going through the index, it doesn’t work. Please help. Thanks |
|
||||
|
Well, if they're loaded by one page only, and the visitor never loads that page, why would you expect the images to be displayed?
__________________
The Penn State Ticket Man http://www.pennstateticketman.com http://www.happyvalleytickets.com http://www.hounddogtours.com |
|
||||
|
Quote:
|
|
||||
|
Quote:
![]()
__________________
The Penn State Ticket Man http://www.pennstateticketman.com http://www.happyvalleytickets.com http://www.hounddogtours.com |
|
|||
|
Regarding judithm (preload img in JavaScript help):-
I assume that you are referring to a second set of images to be used in html event handlers such as onmouseover, onmousedown etc. All other images which are part of the page get downloaded anyway without any action on your part. To have a browser download another set, you can use the following JavaScript conditional if statement:- if(document.images){ var clickme1=new Image(100,30);clickme1.src=""; var clickme2=new Image(100,30);clickme2.src=""; var clickme3=new Image(100,30);clickme3.src=""; var clickme4=new Image(100,30);clickme4.src=""; var clickme5=new Image(100,30);clickme5.src=""; var clickme6=new Image(100,30);clickme6.src=""; var clickme7=new Image(100,30);clickme7.src=""; var clickme8=new Image(50,30);clickme8.src=""; var clickme9=new Image(50,30);clickme9.src=""; var clickme10=new Image(50,30);clickme10.src=""; var clickme11=new Image(100,30);clickme11.src=""; var clickme12=new Image(100,30);clickme12.src=""; } The name which I show clickme1 is the name that I use in my own site to store a second image. You can use whatever name that you wish to use to name the var (storage container). Create a new var for each image. In the clickme1.src double quotes will be the name of the image to be stored. In the first statement the numbers in brackets after new Image is the size of the image in pixels ie 100px width and 30px height. These figures happen to be the figures appropriate to some of my images on my site. You will have to make the changes appropriate to your site images. eg var next_image_one=new Image(85,40);next_image_one.src="this_is_it.gif"; Put the above if conditional statement in a separate script file which you appropriately name and in the head of every page source code put a reference to the separate script file. This will cause every page to download the image files. For example, the script file could be named other_images.js and the reference in the head of every page would be:- <script type="text/JavaScript" src="other_images.js"></script> Iain R Stewart (excarex@yahoo.co.uk) |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AJAX and javascript calling javascript | krnl | Web Programming Discussion Forum | 14 | 11-18-2007 11:00 AM |
| Help with javascript... | beka | Graphics & Design Discussion Forum | 4 | 02-20-2006 07:04 PM |
| Javascript + RSS + RSS = ? | ofoglada | Web Programming Discussion Forum | 6 | 02-05-2006 06:33 AM |
| javascript | souvik das | Submit Your Logo For Review | 2 | 02-25-2005 11:40 AM |
| JavaScript Help | Dragonsi | Web Programming Discussion Forum | 12 | 05-29-2004 05:30 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |