473,500 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hey, I can't get all images pre-loaded in frames

Hi, I've been buried in this project, which has a lot of pre-loaded
images. The pages which have these images are frames.... and even with
my best attempts to preload them all still most do not. Some use more
than one image and the flicker is obvious.

Below is how I am loading them, and it doesn't matter if I use URL
referenced images or locally, (i.e. ./image1.gif)

<script>
pic1= new Image;
pic1.src="./image1.gif";
pic2= new Image;
pic2.src="http://www....";
</script>

Is there a reliable way to pre-load all images in frames, or *should*
this work and it's something else? :)

Sincerely, AmyMC

Nov 28 '06 #1
10 1659
VK
Hi, I've been buried in this project, which has a lot of pre-loaded
images.
<snip>
Below is how I am loading them, and it doesn't matter if I use URL
referenced images or locally, (i.e. ./image1.gif)
Not "locally" but "using relative path" as opposed to "using absolute
path" ;-)
pic1= new Image;
pic1.src="./image1.gif";
pic2= new Image;
pic2.src="http://www....";
</script>
imageObject.src = url is not some magic way to immediately transfer
image from the server into cache, it only places a request for caching.
If your frameset contains really a lot of images then they can be
simply not cached all yet by the moment you start mousing around.
Is there a reliable way to pre-load all images in frames, or *should*
this work and it's something else? :)
In Netscape 3 (where Image / ImageObject.src was introduced) it was
used to pre-cache images and it worked that way just fine. Since then
the "public expectation" is that it will work as on Netscape 3 and
mostly it is this way. From the other side I do not recall any blood
written commitments from browser producers to cache "virtual" images
(declared in the script but not presented on the page).

Nov 29 '06 #2
ASM
AmyMC a écrit :
Hi, I've been buried in this project, which has a lot of pre-loaded
images. The pages which have these images are frames.... and even with
my best attempts to preload them all still most do not. Some use more
than one image and the flicker is obvious.

Below is how I am loading them, and it doesn't matter if I use URL
referenced images or locally, (i.e. ./image1.gif)

<script>
pic1= new Image;
pic1.src="./image1.gif";
pic2= new Image;
pic2.src="http://www....";
that doesn't preload images in cache
they are only a kind of short-cuts to find images.

Once they have beendisplayed, this time they are in cache and it is then
possible to call them from the cache using short-cut picN.src

To post-load images :

var imgs = ['/image1.gif','http://www...'];
var n = imgs.length;
var P = new Array;
function postload() {
if(n==imgs.length) displayPicts();
else {
P[n] = new Image();
P[n].onload = postload;
P[n].src = imgs[n];
n++;
}
}
onload = postload;

function displayPicts() {
for(var i=0; i<document.images.length; i++)
if(document.images['img_'+i])
document.images['img_'+i].src = P[i];
}
</script>

Is there a reliable way to pre-load all images in frames, or *should*
this work and it's something else? :)
Where is the JS preloading images ?

Say it is in frame A and images to display are in A : OK

Say it's in main page :
from frames you would have to call them with : parent.P[x].src
--
Stephane Moriaux et son moins vieux Mac déjà dépassé
Stephane Moriaux and his less old Mac already out of date
Nov 29 '06 #3
Nice. Can you use this on a single page to more reliably load images?
How would that work on a single page? Could you please show a working
example?

Nov 29 '06 #4
To post-load images :

var imgs = ['/image1.gif','http://www...'];
var n = imgs.length;
var P = new Array;
function postload() {
if(n==imgs.length) displayPicts();
else {
P[n] = new Image();
P[n].onload = postload;
P[n].src = imgs[n];
n++;
}
}
onload = postload;

function displayPicts() {
for(var i=0; i<document.images.length; i++)
if(document.images['img_'+i])
document.images['img_'+i].src = P[i];
}
POST LOAD IMAGES? WHAT THE HECK IS THAT?......

Nov 30 '06 #5
ASM
pi********@gmail.com a écrit :
>
POST LOAD IMAGES? WHAT THE HECK IS THAT?......
example :
<http://stephane.moriaux.perso.wanadoo.fr/truc/post_load_movy.shtml>

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 30 '06 #6

ASM wrote:
pi********@gmail.com a écrit :

POST LOAD IMAGES? WHAT THE HECK IS THAT?......

example :
<http://stephane.moriaux.perso.wanadoo.fr/truc/post_load_movy.shtml>
COOL :)), can you get this working in IE7.0? The loading 0/20 doesn't
work and the START/STOP button doesn't appear, but can't tell otherwise
if your demo works :(

Nov 30 '06 #7
ASM
pi********@gmail.com a écrit :
ASM wrote:
>pi********@gmail.com a écrit :
>>POST LOAD IMAGES? WHAT THE HECK IS THAT?......
example :
<http://stephane.moriaux.perso.wanadoo.fr/truc/post_load_movy.shtml>

COOL :)), can you get this working in IE7.0?
I'ven't IE at all.
Please could you make it working ?
The loading 0/20 doesn't
work
Except in Safari (fixed) it worked in all my browsers.
and the START/STOP button doesn't appear,
This time I don't more use usual css It'ld have to run.
but can't tell otherwise
if your demo works :(
See this time

--
Stephane Moriaux et son moins vieux Mac déjà dépassé
Stephane Moriaux and his less old Mac already out of date
Nov 30 '06 #8
I'ven't IE at all.
Please could you make it working ?
The loading 0/20 doesn't
work
I WILL WORK ON THIS TASK AND POST MY RESULTS

Dec 1 '06 #9
ASM
pi********@gmail.com a écrit :
>I'ven't IE at all.
Please could you make it working ?
>>The loading 0/20 doesn't
work

I WILL WORK ON THIS TASK AND POST MY RESULTS
I think that now it is OK :
<http://stephane.moriaux.perso.wanadoo.fr/truc/post_load_movy.shtml>
it works with each of my browsers.
var imgs = ['/image1.gif','http://www...'];
var n = 0;
var P = new Array;
function postload() {
if(n==imgs.length) displayPicts();
else {
P[n] = new Image();
P[n].onload = function() { n++; postload(); }
P[n].src = imgs[n];
}
}
onload = postload;

function displayPicts() {
for(var i=0; i<document.images.length; i++)
if(document.images['img_'+i])
document.images['img_'+i].src = P[i].src;
}
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 1 '06 #10
:) i like this concept, but could you show this working? i put two
google images in there, but unclear if anything is going on. am i
running this correctly to post-load those two? :)

displayPicts() ?

<script>

var imgs =
['http://www.google.com/intl/en_ALL/images/logo.gif','http://www.google.com/images/ribbon_aids_day.gif'];
var n = 0;
var P = new Array;
function postload() {
if(n==imgs.length) displayPicts();
else {
P[n] = new Image();
P[n].onload = function() { n++; postload(); }
P[n].src = imgs[n];
}
}

onload = postload;

function displayPicts() {
for(var i=0; i<document.images.length; i++)
if(document.images['img_'+i])
document.images['img_'+i].src = P[i].src;

}

displayPicts();

</script>

have great day thxs!

Dec 1 '06 #11

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

Similar topics

1
3090
by: Charlie | last post by:
Hi I am using the following code to create an image viewer for multiple images. var pageImage = document.images; var image = new Image(); var args = GetQuerystring(); //return arguments from...
11
7502
by: Penelope Baker | last post by:
Greetings: I cannot seem to get IE 6.0 to pre-cache my rollover images. Every time the user rolls over a link, it rereads it from the server, even though it is well into the cache by that time....
7
3073
by: Ken Smith | last post by:
I have a little video poker game I created in Javascript. It uses Tables and inner html stuff - for example: (psudo-code) imagePicked=random card image (2h.gif);...
15
2309
by: Geoff Cox | last post by:
Hello I have following type of code in the header function pre_load_pics() { if (document.images) { var image1 = new Image(400,265); image1.scr = "pic1.jpg";
5
1859
by: vanisathish | last post by:
Hi I have an application, which has to change to different images based on some conditions. I am trying to call a javascript function(this function changes the images on the front end) from the...
7
1638
by: patrick_woflian | last post by:
hey guys. okay... this may seem confussing to you but im in desperate need of help!! basically i have a list of images in a directory called 'pictures'.. and i was hoping to show them on a web page...
1
1611
by: John | last post by:
I am using the ItemDataBound event on the datagrid to place relevant images in the grid. However, when I press any button on the form which fires a postback the state of the grid is kept but the...
6
1945
by: ste | last post by:
Hi there, I'm just beginning to learn PHP and MySQL, but I'm finding it difficult! I wondered if someone could help me out with a problem I'm having, or at least point me in the right...
3
9494
by: littleark | last post by:
Hi everybody, I have a typical javascript images preloader, it works fine both on Firefox and on IE in my intranet (local server). It works fine on the Internet (remote server) in IE. In...
23
1803
by: SaraLeePerson | last post by:
Dear group, I am seeking a easy to maintain and more importantly *working* way to pre-fetch images, so the pages I develop load smoothly without seeing the images kick in flicker as they usually...
0
7182
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
7232
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7397
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
5490
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,...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.