Display same image on a page multiple times

Y

yk

Hi,

Is it a technique available in html/javascript in order to display same

image many many times on a same page? Because of a large page loading
I am looking for a way not to have same image many times in a page
load, but rather once.

Yefim
 
E

Evertjan.

yk wrote on 12 sep 2006 in comp.lang.javascript:
Hi,

Is it a technique available in html/javascript in order to display same

image many many times on a same page? Because of a large page loading
I am looking for a way not to have same image many times in a page
load, but rather once.

In most browsers, perhaps in all, an image loads only once when displayed
multiple times on the same page.

No need for scripting.
 
A

ASM

Evertjan. a écrit :
yk wrote on 12 sep 2006 in comp.lang.javascript:

a simple css style ?

<style type="text/css">
img.img {
width: 75px; height: 125px;
background: url(folder/image.png) norepeat center center #fff;
}
</style>
<img src="" class="img" alt="virtual image" title="" id="i_0" />
<img src="" class="img" alt="virtual image" title="" id="i_1" />
<img src="" class="img" alt="virtual image" title="" id="i_2" />
<img src="" class="img" alt="virtual image" title="" id="i_3" />
<img src="" class="img" alt="virtual image" title="" id="i_4" />

Craftiness (but not W3C valid) :
http://stephane.moriaux.perso.orange.fr/truc/boul_clic3
(exercise about slide-doors in css+js - click on bulls)
http://stephane.moriaux.perso.orange.fr/truc/boulier_js
(application : same images)
 
R

Richard Cornford

Evertjan. said:
yk wrote on 12 sep 2006 in comp.lang.javascript:

In most browsers, perhaps in all, an image loads only
once when displayed multiple times on the same page.

Wouldn't that depend a great deal on the HTTP headers sent with the
image? If the headers suggested that the image expired immediately (or
in the past), or should not be cached, then it may be re-fetched from
the server for each request. (Browser cache configuration would also be
a factor in conjunction with headers).

But even in a best case of the image being cached on the client hard
disk the actual image data is going to have to be transferred to display
memory multiple times, but that cannot be avoided if the user is to see
the image in multiple places at once.
No need for scripting.

None.

Richard.
 
E

Evertjan.

Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
Wouldn't that depend a great deal on the HTTP headers sent with the
image?
If the headers suggested that the image expired immediately (or
in the past), or should not be cached, then it may be re-fetched from
the server for each request.

You are right, never thought about that, Richard.

I must remember this and think up a use for manipulating image headers.
Perhaps in a page counter? Well, there are better totally serverside ways
for that.
(Browser cache configuration would also be
a factor in conjunction with headers).

"most browsers" are used "out of the box".
But even in a best case of the image being cached on the client hard
disk the actual image data is going to have to be transferred to
display memory multiple times, but that cannot be avoided if the user
is to see the image in multiple places at once.

I believe that is not the kind of loading ment in the OQ ;-}
 
R

Richard Cornford

Evertjan. said:
Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:

"most browsers" are used "out of the box".

But development browser often have caching settings altered so that
updated work-in-progress is loaded from the server rather then having
old version retrieved from the cache. Those setting will also influence
image loading, and so if not fully understood may give the impression
that images are being continually downloaded when in real world
browsers there may be no issue.

Richard.
 
E

Evertjan.

Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
But development browser often have caching settings altered so that
updated work-in-progress is loaded from the server rather then having
old version retrieved from the cache. Those setting will also influence
image loading, and so if not fully understood may give the impression
that images are being continually downloaded when in real world
browsers there may be no issue.

Mmmmmmmmmmmmmmmyyy... Yes!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top