473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

preolad image

hello,

i use this code to preload image :

<script language="JavaScript">
<!--
function preloadimages() {
var d=document;
if(d.images){
if (!d.preload) { d.preload=new Array(); }
var i,j=d.preload.length,a=preloadimages.arguments;
for(i=0; i<a.length; i++) {
if (a[i].indexOf("#")!=0){ d.preload[j]=new Image;
d.preload[j++].src=a[i]; }
}
}
}
preloadimages('http://www.carlays.com/filedata/picture/w380h380/CA_P1_1_1769
643799.jpg','http://www.carlays.com/filedata/picture/w380h380/CA_P1_2_142876
519.jpg','http://www.carlays.com/filedata/picture/w380h380/CA_P1_3_396951326
..jpg','http://www.carlays.com/filedata/picture/w380h380/CA_P1_4_610955261.jp
g','http://www.carlays.com/filedata/picture/w380h380/CA_P1_5_1357663683.jpg'
,'http://www.carlays.com/filedata/picture/w380h380/CA_P1_6_1069878835.jpg','
http://www.carlays.com/filedata/picture/w380h380/CA_P1_7_1221341449.jpg','http://www.carlays.com/filedata/picture/w380h380/CA_P1_8_314781705.jpg');

//-->
</SCRIPT>
You can see an exemple at http://www.carlays.com/T1
The only probleme is that this code is call before all image in the web page
are loaded ! (try http://www.carlays.com/T1 with a low internet connection
to see an exemple) ...
that mean i need to wait that all the image in preoladimage function are
loaded to see the entire content of my webpage :(
How can i delay the call of the function preloadimage after the moment of
all the image in the web page are loaded ?

thank you by advance
stephane
Jul 20 '05 #1
2 1710
@SM
Stephane Vander Clock a ecrit :

i use this code to preload image :


try :

<body onload="postloadimages();">

<script language="JavaScript"><!--

function postloadimages(){
if(document.images)
{
// path Of Images
var p='http://www.carlays.com/filedata/picture/w380h380/';

MyImages = new Array('CA_P1_1_1769643799.jpg','CA_P1_2_142876519. jpg',
'CA_P1_3_396951326.jpg','CA_P1_4_610955261.jpg',
'CA_P1_5_1357663683.jpg','CA_P1_6_1069878835.jpg',
'CA_P1_7_1221341449.jpg','CA_P1_8_314781705.jpg');

a = new Array();
for(var i=0; i<MyImages.length; i++) {
a[i] = new Image();
a[i].src = p+MyImages[i];
}
verifImages();
}
}

function verifImages() {
var ok=0;
for(var i=0;i<a.length;i++)
if(!(a[i].complete)) ok=1;
if(ok==1) setTimeout('verifImages()',200);
}

//--></SCRIPT>

--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************
Jul 20 '05 #2
merci beaucoup

stephane

"@SM" <st*********************@wanadoo.fr> wrote in message
news:40***************@wanadoo.fr...
Stephane Vander Clock a ecrit :

i use this code to preload image :


try :

<body onload="postloadimages();">

<script language="JavaScript"><!--

function postloadimages(){
if(document.images)
{
// path Of Images
var p='http://www.carlays.com/filedata/picture/w380h380/';

MyImages = new Array('CA_P1_1_1769643799.jpg','CA_P1_2_142876519. jpg',
'CA_P1_3_396951326.jpg','CA_P1_4_610955261.jpg',
'CA_P1_5_1357663683.jpg','CA_P1_6_1069878835.jpg',
'CA_P1_7_1221341449.jpg','CA_P1_8_314781705.jpg');

a = new Array();
for(var i=0; i<MyImages.length; i++) {
a[i] = new Image();
a[i].src = p+MyImages[i];
}
verifImages();
}
}

function verifImages() {
var ok=0;
for(var i=0;i<a.length;i++)
if(!(a[i].complete)) ok=1;
if(ok==1) setTimeout('verifImages()',200);
}

//--></SCRIPT>

--
******** (enlever/remove [OTER_MOI] du/from reply url) *******
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephane.moriaux/internet/
************************************************** ************

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Pierre Tremblay | last post by:
Hi! I am trying to display an image in my html document. The document contains the following line: <td class="Input"><img...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
2
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does anybody have an idea how I can make it work again or...
8
by: Jef Driesen | last post by:
I'm implementing some image processing algorithms in C++. I created a class called 'image' (see declaration below), that will take care of the memory allocations and some basic (mathematical)...
6
by: QuasiChameleon | last post by:
Hi, I'm trying to create a grayscale image class that reads and writes grayscale Targa format. This works well with smaller images, but corrupts larger images and creates a "Segmentation fault...
15
by: Anand Ganesh | last post by:
HI All, I have an Image. I want to clip a portion of it and copy to another image. How to do this? I know the bounding rectangle to clip. Any suggestions please. Thanks for your time and...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.