How can I display a random picture?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on each
visit/refresh. I don't want to copy exactly what he has but have something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top right,
i.e. in the banner. This area is protected and can only be edited by opening
the attached DWT, not sure if this complicates matters. The alternative would
be a panel on the right but this is already used for other content on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="displayRandomImage('csmember',urls)">
<!-- csmember is the NAME of the image receiving the random changes -->
 
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be me
though. I have placed the exact contents of your script in the head of one of
my pages (not DWT, just a normal page) and the other line in the body for an
area I know is free. Checked images, filenames, locations, etc. All fine, but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

Murray said:
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open = SymWinOpen; displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random changes -->



--
Murray
============

Stefan said:
How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on each
visit/refresh. I don't want to copy exactly what he has but have something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The alternative
would
be a panel on the right but this is already used for other content on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Pls ignore the bit about the function def'n being a comment, I am being dim
(but it still won't work though)

Stefan said:
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be me
though. I have placed the exact contents of your script in the head of one of
my pages (not DWT, just a normal page) and the other line in the body for an
area I know is free. Checked images, filenames, locations, etc. All fine, but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

Murray said:
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open = SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen; displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random changes -->



--
Murray
============

Stefan said:
How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on each
visit/refresh. I don't want to copy exactly what he has but have something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The alternative
would
be a panel on the right but this is already used for other content on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Nope, still nothing. You said "csmember is the NAME of the image receiving
the random changes". Should I be creating a "container" or "recipient" for
the random image somehow? There is no image called "csmember" on the page (or
am I - highly likely - missing the point?)

Many thanks!
Stefan

Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being dim
(but it still won't work though)

Stefan said:
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be me
though. I have placed the exact contents of your script in the head of one of
my pages (not DWT, just a normal page) and the other line in the body for an
area I know is free. Checked images, filenames, locations, etc. All fine, but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

Murray said:
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open = SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen; displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;; window.open = SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on each
visit/refresh. I don't want to copy exactly what he has but have something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The alternative
would
be a panel on the right but this is already used for other content on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on the
trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

Stefan said:
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be
me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body for
an
area I know is free. Checked images, filenames, locations, etc. All fine,
but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

Murray said:
Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen;
displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;;
window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on
each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content on
some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Jon, thanks. Which bit goes where? (bearing in mind that all this HTML is
rather daunting to a newbie like me) All in the <head> or in <body> or split
across the two and where exactly, just at the start, at the end or should I
insert some of it where I want the image to appear?

Doh...

Thanks,

Stefan

Jon Spivey said:
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on the
trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

Stefan said:
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be
me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body for
an
area I know is free. Checked images, filenames, locations, etc. All fine,
but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

:

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open = SymWinOpen; var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen;
displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;;
window.open = SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed on
each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content on
some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Hi,
sorry - stick this on a page
<html>
<head>
<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
</head>
<body>
<img name="RandomImage">
</body>
</html>

Make sure the 2 lines starting with var a = and document.images don't have
line breaks - they wrap in my newsreader.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Jon, thanks. Which bit goes where? (bearing in mind that all this HTML is
rather daunting to a newbie like me) All in the <head> or in <body> or
split
across the two and where exactly, just at the start, at the end or should
I
insert some of it where I want the image to appear?

Doh...

Thanks,

Stefan

Jon Spivey said:
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on
the
trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

:

Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must
be
me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body
for
an
area I know is free. Checked images, filenames, locations, etc. All
fine,
but
it won't work. Is there a typo in your script maybe (I noticed that
the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

:

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open =
SymWinOpen;
displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;;
window.open = SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random
changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to
be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed
on
each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the
top
right,
i.e. in the banner. This area is protected and can only be edited
by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content
on
some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Jon:

Take a look here where you can see it work -

http://www.reedfax.com

I can see that the passage from my system to the forum has damaged the
script - sorry for the confusion!

Let's see if this works better -

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="displayRandomImage('csmember',urls)">
<!-- csmember is the NAME of the image receiving the random changes -->

(proofreading this it looks OK to me here - the onLoad call should be
displayRandomImage('csmember',urls) ONLY - all that other scruff about
SymTmpWinOpen and window.open looks like the nefarious work of Norton)

--
Murray
============

Jon Spivey said:
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on
the trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

Stefan said:
Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be
me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body
for an
area I know is free. Checked images, filenames, locations, etc. All
fine, but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

:

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open = SymWinOpen;
displayRandomImage('csmember',urls); window.open = SymTmpWinOpen;;
window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random
changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed
on each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the
top
right,
i.e. in the banner. This area is protected and can only be edited by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content
on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Ok, I see it now. In the first place it was using time to chose the image
that threw me. Here's a quickie with my script
http://www.heresyourbook.com/random/

There's a lot of ways to skin this cat, ideally I'd want to pick the image
server rather than client side and if need be determine it's dimensions so
we can send a full image tag to the client. Anyway hopefully the poster has
got something he can use.

--
Cheers,
Jon
Microsoft MVP

Murray said:
Jon:

Take a look here where you can see it work -

http://www.reedfax.com

I can see that the passage from my system to the forum has damaged the
script - sorry for the confusion!

Let's see if this works better -

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="displayRandomImage('csmember',urls)">
<!-- csmember is the NAME of the image receiving the random changes -->

(proofreading this it looks OK to me here - the onLoad call should be
displayRandomImage('csmember',urls) ONLY - all that other scruff about
SymTmpWinOpen and window.open looks like the nefarious work of Norton)

--
Murray
============

Jon Spivey said:
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on
the trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Stefan said:
Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

:

Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must be
me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body
for an
area I know is free. Checked images, filenames, locations, etc. All
fine, but
it won't work. Is there a typo in your script maybe (I noticed that the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

:

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open =
SymWinOpen; displayRandomImage('csmember',urls); window.open =
SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random
changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to
be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed
on each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the
top
right,
i.e. in the banner. This area is protected and can only be edited
by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content
on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 
Yeah - I don't disagree with that. Usually these things are better done
server side....

--
Murray
============

Jon Spivey said:
Ok, I see it now. In the first place it was using time to chose the image
that threw me. Here's a quickie with my script
http://www.heresyourbook.com/random/

There's a lot of ways to skin this cat, ideally I'd want to pick the image
server rather than client side and if need be determine it's dimensions so
we can send a full image tag to the client. Anyway hopefully the poster
has got something he can use.

--
Cheers,
Jon
Microsoft MVP

Murray said:
Jon:

Take a look here where you can see it work -

http://www.reedfax.com

I can see that the passage from my system to the forum has damaged the
script - sorry for the confusion!

Let's see if this works better -

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="displayRandomImage('csmember',urls)">
<!-- csmember is the NAME of the image receiving the random changes -->

(proofreading this it looks OK to me here - the onLoad call should be
displayRandomImage('csmember',urls) ONLY - all that other scruff about
SymTmpWinOpen and window.open looks like the nefarious work of Norton)

--
Murray
============

Jon Spivey said:
Have to admit I don't understand that script. How about

<script type="text/javascript">
function randomImages(){
var a = new Array('Picture1.jpg', 'Picture2.jpg', 'Picture3.jpg',
'Picture4.jpg'); // add as many images as you like here
document.images['RandomImage'].src = a[Math.floor(Math.random() *
a.length)];
}
onload=randomImages;
</script>
<img name="RandomImage">
</body>

The image won't be truely random - you might get the same image twice on
the trot - but I think it will serve your purpose.

--
Cheers,
Jon
Microsoft MVP


Pls ignore the bit about the function def'n being a comment, I am being
dim
(but it still won't work though)

:

Hi Murray,

Many thanks. I'm having trouble getting that to work - think it must
be me
though. I have placed the exact contents of your script in the head of
one of
my pages (not DWT, just a normal page) and the other line in the body
for an
area I know is free. Checked images, filenames, locations, etc. All
fine, but
it won't work. Is there a typo in your script maybe (I noticed that
the
function definition is effectively a comment - is that right?)

Pardon me for being so dim!

:

Put this in the head of the document -

<script type="text/javascript">
<!--
function displayRandomImage(imageName,array){
document.images[imageName].src=array[new
Date().getTime()%array.length];
}
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg"]
// load this line with your image names and paths
//-->
</script>

and then put this in the body of the page -

<body onLoad="var SymTmpWinOpen = window.open; window.open =
SymWinOpen; var SymTmpWinOpen = window.open; window.open =
SymWinOpen; displayRandomImage('csmember',urls); window.open =
SymTmpWinOpen;; window.open = SymTmpWinOpen;">
<!-- csmember is the NAME of the image receiving the random
changes -->



--
Murray
============

How can I display a "random" picture on my site? (doesn't have to
be
genuinely random, can just be "next in series")

The best example I have seen of this is Mike Pugh's site:
www.vagabonding.com In the header a different picture is displayed
on each
visit/refresh. I don't want to copy exactly what he has but have
something
fairly similar in mind.

On my site (www.aaltenvoogd.com) I would like to show this on the
top
right,
i.e. in the banner. This area is protected and can only be edited
by
opening
the attached DWT, not sure if this complicates matters. The
alternative
would
be a panel on the right but this is already used for other content
on some
pages (e.g. maps in the country pages).

Many thanks in advance for your help!
Stefan
 

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

Back
Top