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

how to load a different image on a web page

P: n/a
Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?
Thanks,
yip

Feb 5 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"ipy2006" <ip*******@gmail.comwrites:
Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?
This is a case for a server-side script. It is a matter of a few
minutes and will work for all your visitors (that view images).

The "other than" is rather odd since JS will not work "every time" but
only some times.

--
Ben.
Feb 5 '07 #2

P: n/a
On Feb 5, 1:03 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
"ipy2006" <ipyasa...@gmail.comwrites:
Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?

This is a case for a server-side script. It is a matter of a few
minutes and will work for all your visitors (that view images).

The "other than" is rather odd since JS will not work "every time" but
only some times.

--
Ben.
Thanks for the reply. If you look at http://www.nyu.edu everytime you
open this url in a browser you will see a new <divelement. Do you
think it is created by a server side script or by some Ajax code? From
my observation I don't see any server side code there. Please comment.

<div id="photography">
<img src="/v50/images/photos/42/4x2_35980Pg20.jpg" alt="" />
</div>

Feb 5 '07 #3

P: n/a
On 02/05/2007 01:14 PM, ipy2006 wrote:
On Feb 5, 1:03 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>"ipy2006" <ipyasa...@gmail.comwrites:
>>Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?
This is a case for a server-side script. It is a matter of a few
minutes and will work for all your visitors (that view images).

The "other than" is rather odd since JS will not work "every time" but
only some times.

--
Ben.

Thanks for the reply. If you look at http://www.nyu.edu everytime you
open this url in a browser you will see a new <divelement. Do you
think it is created by a server side script or by some Ajax code? From
my observation I don't see any server side code there. Please comment.

<div id="photography">
<img src="/v50/images/photos/42/4x2_35980Pg20.jpg" alt="" />
</div>
Server-side code is executed on the server to (typically) generate the
HTML that you see. You can probably do what you're trying to do by using
a combination of a cookie and a server-side script.
--
Windows Vista and your freedom in conflict:
http://www.securityfocus.com/columnists/420/2
Feb 5 '07 #4

P: n/a
"ipy2006" <ip*******@gmail.comwrites:
On Feb 5, 1:03 pm, Ben Bacarisse <ben.use...@bsb.me.ukwrote:
>"ipy2006" <ipyasa...@gmail.comwrites:
Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?

This is a case for a server-side script. It is a matter of a few
minutes and will work for all your visitors (that view images).

The "other than" is rather odd since JS will not work "every time" but
only some times.

Thanks for the reply. If you look at http://www.nyu.edu everytime you
open this url in a browser you will see a new <divelement. Do you
think it is created by a server side script or by some Ajax code? From
my observation I don't see any server side code there. Please
comment.
The photos appear (and change) when all client-side scripting is off
so a server-side script is probably generating the changed content.
You say you can't see any server code there, but server-side code is
almost always hidden.

There is also a lot of client-side scripting on the page so when that
is active it may also do changing the content. I did not try to find
out what any of it did. Browser sniffing, like glue sniffing, makes
my head hurt.

--
Ben.
Feb 5 '07 #5

P: n/a

"ipy2006" <ip*******@gmail.comwrote in message
news:11*********************@a75g2000cwd.googlegro ups.com...
Other than the JavaScript of timing and rotating images every few
seconds or minutes, is there a way to uniquely load a different
picture every time a browser open a page?
Thanks,
yip
php
http://alistapart.com/articles/randomizer/
Feb 5 '07 #6

P: n/a
Ben Bacarisse wrote [in part]:
"ipy2006" <ip*******@gmail.comwrites:
>Thanks for the reply. If you look at http://www.nyu.edu everytime you
open this url in a browser you will see a new <divelement. Do you
think it is created by a server side script or by some Ajax code? From
my observation I don't see any server side code there. Please
comment.

The photos appear (and change) when all client-side scripting is off
so a server-side script is probably generating the changed content.
You say you can't see any server code there, but server-side code is
almost always hidden.
A server-side include (SSI) script executes on the Web server before the
requested Web page is sent. If the SSI affects content within the page,
that effect appears as if pre-coded into the page. You do not see the
SSI itself.

If you go to my home page (see signature below), scroll to the bottom,
and select the link "Index of HTML Files", you will get a page with the
index of all HTML files on my site. This is generated by a SSI called
from <http://www.rossde.com/get_index.html>. If you look at the source
HTML of that page, you will see the table structure of the display. You
will NOT see the UNIX Korn shell SSI script -- named get_index.ksh --
that generated the source HTML. You will not even see the call to
get_index.ksh, which the Web server replaced with the results of
executing that SSI.

The same is true of the "hit" counters in my pages; the count looks
hard-coded into the HTML. I see the calls to the SSIs when I view my
HTML on my server, which you can't see because you don't have access. I
also see the calls in the HTML on my PC, where I develop and maintain my
pages before uploading to the server. If I view one of those pages in a
browser, the results of an SSI is a blank because my PC is not a server
and thus can't execute the SSI. If I view one of my pages by loading it
from the server, I see the SSI results. If I then download that page to
my PC, the HTML contains the results of the SSI, not the call to it.

--

David E. Ross
<http://www.rossde.com/>

I use SeaMonkey as my Web browser because I want
a browser that complies with Web standards. See
<http://www.mozilla.org/projects/seamonkey/>.
Feb 6 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.