how to load a different image on a web page

I

ipy2006

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
 
B

Ben Bacarisse

ipy2006 said:
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.
 
C

cwdjrxyz

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

You actually can use javascript to load an image at random every time
the page is opened or refreshed. You can also add noscript to select a
single image to display if script is turned off on the viewing
browser. If you have access to php on the server, a php script can be
used to do the same thing, and it can not be turned off by the viewer.
See an example at http://wineFAQ.hostexcellence.com with the external
script at http://wineFAQ.hostexcellence.com/wine/rand2.js . The main
thing to watch is that the array used will tolerate no errors. Just a
single missing or extra character in the array can completely kill the
script.
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top