random pictures

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

Guest

I am very new to Frontpage, and I hope someone can help me.

I want to add rotating pictures. Basically on the left panel of my site, I
would like different pictures in my images folder to be displayed randomly on
my home page when visiting my site. Is that possible? If so, how do I do it?

Thanks!
 
Yea I was on there, but I couldn't really find anything on there.

I simply want to put 10 or so pictures in an image folder, and have a
different one in a cell displayed each time my home page is visited, or
refreshed.

Anyone?
 
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 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,
As always, you give precise info.

I am not the OP but, to further my knowledge, I am wondering what the % in
document.images[imageName].src=array[new Date().getTime()%array.length];
means.

I can see that "array" is a parameter to the function. In fact it is urls as
defined within <script>. So array.length is the length of that array (in
your example 4).
But what is %array.length ?
 
Thanks for the reply, I appreciate it.

To somewhat add to the question, I have a photobucket account as well, would
it be possible to have a random picture come up on my site, but rather than
the source being from a picture in an image folder, could I use a random irl
from my photobucket acct to provide the source for the picture?



Trevor L. said:
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,
As always, you give precise info.

I am not the OP but, to further my knowledge, I am wondering what the % in
document.images[imageName].src=array[new Date().getTime()%array.length];
means.

I can see that "array" is a parameter to the function. In fact it is urls as
defined within <script>. So array.length is the length of that array (in
your example 4).
But what is %array.length ?
 
Al said:
Thanks for the reply, I appreciate it.

To somewhat add to the question, I have a photobucket account as
well, would it be possible to have a random picture come up on my
site, but rather than the source being from a picture in an image
folder, could I use a random irl from my photobucket acct to provide
the source for the picture?

Al,
I think you are eplying to Murray, nt me.

Anyhow, if the image you want has an address on ht eweb, just use that
e.g.
urls=["images/cs1.jpg","images/cs2.jpg","images/cs3.jpg","images/cs4.jpg",
http://mydomain.com/images/xxxx.jpg]

The last reference should be to an image which exists on the web,
e.g. you could use http://tandcl.homemail.com.au/images/display/trevor.jpg
and you will get a picture of my ugly mug !!
 
It's a mod function. It's a way of constraining the random numbers to be no
larger than the array length.

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

Trevor L. said:
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,
As always, you give precise info.

I am not the OP but, to further my knowledge, I am wondering what the %
in
document.images[imageName].src=array[new Date().getTime()%array.length];
means.

I can see that "array" is a parameter to the function. In fact it is urls
as defined within <script>. So array.length is the length of that array
(in your example 4).
But what is %array.length ?
 
Back
Top