Image change when a page refreshes

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

Guest

I am trying to set up a series of images that change when the page is
refreshed - not on a mouseover or click, but just when it reloads, so that on
each visit the image will be different. Can I do this with FP Behaviors?
I'm not much of a coder, so I'm trying to do it in FrontPage if possible.

Thanks,
Jenn
 
Hi
You can create a Picture Based on Schedule using the insert web component.
To do this go to Insert, Web Component, on the component type select
Included Content and choose Picture Based Schedule.
 
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 HTML NAME of the image receiving the random changes
(not the filename) -->
 
However that method requires you to open the site in FP each time you want the change to happen.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
Murrany,
thanks for the script - but what is the difference between the HTML name and
the filename for my random inage?

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="displayRandomImage('csmember',urls)">
<!-- csmember is the HTML NAME of the image receiving the random changes
(not the filename) -->



--
Murray
Jenn said:
I am trying to set up a series of images that change when the page is
refreshed - not on a mouseover or click, but just when it reloads, so that
on
each visit the image will be different. Can I do this with FP Behaviors?
I'm not much of a coder, so I'm trying to do it in FrontPage if possible.

Thanks,
Jenn
 
<img name="htmlname" src="filename.gif"....>

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

Jenn said:
Murrany,
thanks for the script - but what is the difference between the HTML name
and
the filename for my random inage?

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="displayRandomImage('csmember',urls)">
<!-- csmember is the HTML NAME of the image receiving the random changes
(not the filename) -->



--
Murray
Jenn said:
I am trying to set up a series of images that change when the page is
refreshed - not on a mouseover or click, but just when it reloads, so
that
on
each visit the image will be different. Can I do this with FP
Behaviors?
I'm not much of a coder, so I'm trying to do it in FrontPage if
possible.

Thanks,
Jenn
 
Back
Top