Click to See Complete Forum and Search --> : rotating images


Janna
07-14-2003, 03:43 PM
HI:
Currently on our site, we have rotating pictures, that is each time you enter the site a new picture is shown, there are only about 6 or so of them. Here is the site: http://alaska.fws.gov/
Can you get the code for me for this or can you tell me how to do it or where to get it from.
The guy who did this is unavailable.

Thank you for your time. Janna

janna_taylor@fws.gov

Mr J
07-14-2003, 05:08 PM
The following script will show a randomly selected image whenever the page is loaded.

Change the images "pic1.jpg","pic2.jpg" to your own

<HTML>
<HEAD>
<TITLE>Document Title</TITLE>
</HEAD>
<BODY onload="show_pic()">
<script language="javascript">
<!--

mypics=new Array("pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg","pic5.jpg","pic6.jpg")

function show_pic(){
randomNum=Math.floor(Math.random() * mypics.length);
document.getElementById("myimage").src=mypics[randomNum];
alert(randomNum)
}
//-->
</script>

<img id="myimage" src="pic1.jpg" width="380" height="300" alt="My Picture">
</BODY>
</HTML>

Janna
07-14-2003, 05:20 PM
Thank you, I'll give that a try. Janna