Is there any way to make a photo change on page load?

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

Guest

FrontPage 2003; I need to have a new photo appear each time the page loads.
Can this be done with FrontPage?
 
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 -->
 
Murry,
Thanks for the info, but I'm a novice when it comes to javascript. I
followed your instructions but am getting an error 'document.images[...]' is
null or not an object.

What am I missing? I'm not sure what to change to my data.

Any help would be appreciated.


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 NAME of the image receiving the random changes -->



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

FrontPagedesigns said:
FrontPage 2003; I need to have a new photo appear each time the page
loads.
Can this be done with FrontPage?
 
Can you show me your page - maybe upload it and post a link to it?

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

FrontPagedesigns said:
Murry,
Thanks for the info, but I'm a novice when it comes to javascript. I
followed your instructions but am getting an error 'document.images[...]'
is
null or not an object.

What am I missing? I'm not sure what to change to my data.

Any help would be appreciated.


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 NAME of the image receiving the random changes -->



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

FrontPagedesigns said:
FrontPage 2003; I need to have a new photo appear each time the page
loads.
Can this be done with FrontPage?
 
Back
Top