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

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

Guest

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

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