By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Display same image on a page multiple times

P: n/a
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

Sep 12 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 12 '06 #2

P: n/a
ASM
Evertjan. a écrit :
yk wrote on 12 sep 2006 in comp.lang.javascript:
>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.
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)

--
Stephane Moriaux et son [moins] vieux Mac
Sep 12 '06 #3

P: n/a
Evertjan. wrote:
yk wrote on 12 sep 2006 in comp.lang.javascript:
>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.
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.
Sep 12 '06 #4

P: n/a
Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
Evertjan. wrote:
>yk wrote on 12 sep 2006 in comp.lang.javascript:
>>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.

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 ;-}
>No need for scripting.

None.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 13 '06 #5

P: n/a
Evertjan. wrote:
Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
<snip>
>(Browser cache configuration would also be
a factor in conjunction with headers).

"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.

Sep 13 '06 #6

P: n/a
Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
Evertjan. wrote:
>Richard Cornford wrote on 13 sep 2006 in comp.lang.javascript:
<snip>
>>(Browser cache configuration would also be
a factor in conjunction with headers).

"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.
Mmmmmmmmmmmmmmmyyy... Yes!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.