473,624 Members | 2,245 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 1682
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','ht tp://www...'];
var n = imgs.length;
var P = new Array;
function postload() {
if(n==imgs.leng th) 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.imag es.length; i++)
if(document.ima ges['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','ht tp://www...'];
var n = imgs.length;
var P = new Array;
function postload() {
if(n==imgs.leng th) 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.imag es.length; i++)
if(document.ima ges['img_'+i])
document.images['img_'+i].src = P[i];
}
POST LOAD IMAGES? WHAT THE HECK IS THAT?......

Nov 30 '06 #5
ASM
pi********@gmai l.com a écrit :
>
POST LOAD IMAGES? WHAT THE HECK IS THAT?......
example :
<http://stephane.moriau x.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********@gmai l.com a écrit :

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

example :
<http://stephane.moriau x.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********@gmai l.com a écrit :
ASM wrote:
>pi********@gmai l.com a écrit :
>>POST LOAD IMAGES? WHAT THE HECK IS THAT?......
example :
<http://stephane.moriau x.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********@gmai l.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.moriau x.perso.wanadoo .fr/truc/post_load_movy. shtml>
it works with each of my browsers.
var imgs = ['/image1.gif','ht tp://www...'];
var n = 0;
var P = new Array;
function postload() {
if(n==imgs.leng th) 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.imag es.length; i++)
if(document.ima ges['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

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

Similar topics

1
3104
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 querystring image.src = args.imageSource; //get image src pageImage.src = ""; pageImage.src = image.src;
11
7517
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. It works fine in Netscape, Mozilla, Firebird, Firefox, etc. Suggestions? (Other than the obvious one regarding IE :P) Thanks!
7
3083
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); getElementById(cellNum).innerHTML="<img src='imagePicked'>"; I use small 1k.gif images for the cards. Sometimes on the net the 1k.gifs take a while to load & kills bandwith traffic.
15
2323
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
1864
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 ASP script. I want to preload all the images to the client side browser and point to a different image source through the javascript.how do i do this in javascript. any pointers appreciated THanks
7
1645
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 by the following code: <?php $handle = opendir('pictures'); if($handle) {
1
1627
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 images no longer appear as the ItemDataBound event is no longer fired. The solution to this is to refresh the grid with the original data using the page load event after postback but then it loses the data that the user has already typed into the...
6
1951
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 direction? I have setup a MySQL database which contains the following, though I would like to expand on this in the future with lots of extra fields: IMAGES TABLE: -------------------
3
9508
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 Firefox it stops before loading every image. Does image.onload function have some problems with little images?
23
1816
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 do. Important - I need this to work on Internet Explorer 6.0+ and FireFox. I am presently using at the head of the page, pic100= new Image;
0
8233
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8170
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8619
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2604
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 we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.