How do I display different pictures each time a page is visited?

C

Creekside

I have a website and would like to display a variety of cartoons on the home
page - in one location that change when the page is revisited or refreshed.
 
S

Steve Easton

Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
M

Murray

No it doesn't.

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 -->
 
S

Steve Easton

Yes it does, want a sample??



--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
 
M

Murray

Try mine. Client-side all the way.

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

Steve Easton said:
Yes it does, want a sample??



--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters
CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

I have a website and would like to display a variety of cartoons on
the
home
page - in one location that change when the page is revisited or
refreshed.
 
S

Steve Easton

I meant the CPanel has the feature.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
 
M

Murray

Sorry - you lost me....

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

Steve Easton said:
I meant the CPanel has the feature.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters
CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

I have a website and would like to display a variety of cartoons on
the
home
page - in one location that change when the page is revisited or
refreshed.
 
S

Steve Easton

LOL.

When you said no it doesn't, I thought you were talking about the CPanel

Hey, it's Friday, I'm easily confused.

;-)

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer

Murray said:
Sorry - you lost me....

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

Steve Easton said:
I meant the CPanel has the feature.

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

Murray said:
No it doesn't.

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



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

Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters
CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

I have a website and would like to display a variety of cartoons on
the
home
page - in one location that change when the page is revisited or
refreshed.
 
A

Andrew Murray

it can also be done with Javascript.

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
 
S

Steve Easton

Uh uh.

The world's not round.
We can't get there from here,
so.... we need to start from someplace else.


;-)

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
T

Trevor L.

Maybe the world goes around and around.

But if you start at Murray's solution, you won't need to go any further.

It is an elegant piece of code and I can see that it will work 100%. (I
don't even need to try it; Murray is the guru. )
 
M

Murray

<flex> 8)

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

Trevor L. said:
Maybe the world goes around and around.

But if you start at Murray's solution, you won't need to go any further.

It is an elegant piece of code and I can see that it will work 100%. (I
don't even need to try it; Murray is the guru. )
 
C

Creekside

Thanks, guys! Now all I need is some time to put it in the site. You've
saved me hours of hunting for code.

Kathy

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
 
M

Murray

Good luck!

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

Creekside said:
Thanks, guys! Now all I need is some time to put it in the site. You've
saved me hours of hunting for code.

Kathy

Murray said:
No it doesn't.

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



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

Steve Easton said:
Requires some server side scripting.

If you are hosted on an Apache / UNIX server, with the web masters
CPanel,
There is probably a built in feature that will do just what you want.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer

I have a website and would like to display a variety of cartoons on
the
home
page - in one location that change when the page is revisited or
refreshed.
 
Top