Total members 11893 |It is currently Mon Nov 04, 2024 11:23 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





If you're looking for a way to speed up your web site's perceived load time, preloading your images may be your answer. By using the following JavaScript code, you can preload the images you specify prior to your web page opening. This will enable your images to promptly display instead of your visitors having to wait for them to load.

Place this code between your <HEAD> and </HEAD> tags:

Code:
<SCRIPT language="JavaScript">
<!-- Script courtesy of http://www.web-source.net - Your Guide to Professional Web Site Design and Development
var preload=new Image();
preload.src="(image.gif)";
// -->
</SCRIPT>


Edit the text indicated in red to your image file name.



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

If i am to use this code for upload of multiple images how do i go about separating the image files in the Javascript?

Do i use a comma e.g,

preload.src="(image1.gif, image2.gif)"

or

preload.src="(image1.gif)(image2.gif)"

Im new to Javascript and realise i should know this.


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Preloading Images javascript code
 Javascript Code For Moving Images On Click Of A Button     -  
 Javascript code with Unity3D     -  
 First Visit Pop Up Window javascript code     -  
 Redirect to a New Page javascript code     -  
 Back to previous page javascript code     -  
 Status Bar Link Description javascript code     -  
 Reload a Window With a Button javascript code     -  
 Typing Status Bar Text javascript code     -  
 Sequence of Images , draw several images in a row     -  
 aligning the scanned images     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com