OZSJ
asked on
Rotate image javascript
Hi,
I have created a simple page in Dreamweaver that displays six images across the page. I want each of these six images to rotate with four different images. I have found this javascript but simply do not know how to get it working.
Should I have an image called Picture(1).jpg or is this (1) part of the array?
Where should these images be placed?
Also, should img src ="" remain, or do I need to replace this with the name of an existing image?
Any help would be appreciated.
<html>
<head>
<title>Image Rotate
</head>
<body>
<img src="" name="Rotating" id="Rotating1" width=100 height=100>
<img src="" name="Rotating" id="Rotating2" width=100 height=100>
<script language="JavaScript">
var ImageArr1 = new Array("Picture(3).jpg","Pi cture(1).j pg","Pictu re(2).jpg" );
var ImageHolder1 = document.getElementById('R otating1') ;
var ImageArr2 = new Array("Picture(5).jpg","Pi cture(6).j pg","Pictu re(7).jpg" );
var ImageHolder2 = document.getElementById('R otating2') ;
function RotateImages(whichHolder,S tart)
{
var a = eval("ImageArr"+whichHolde r);
var b = eval("ImageHolder"+whichHo lder);
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateI mages("+wh ichHolder+ ","+(Start +1)+")",15 00);
}
RotateImages(1,0);
RotateImages(2,0);
</script>
</body>
</html>
I have created a simple page in Dreamweaver that displays six images across the page. I want each of these six images to rotate with four different images. I have found this javascript but simply do not know how to get it working.
Should I have an image called Picture(1).jpg or is this (1) part of the array?
Where should these images be placed?
Also, should img src ="" remain, or do I need to replace this with the name of an existing image?
Any help would be appreciated.
<html>
<head>
<title>Image Rotate
</head>
<body>
<img src="" name="Rotating" id="Rotating1" width=100 height=100>
<img src="" name="Rotating" id="Rotating2" width=100 height=100>
<script language="JavaScript">
var ImageArr1 = new Array("Picture(3).jpg","Pi
var ImageHolder1 = document.getElementById('R
var ImageArr2 = new Array("Picture(5).jpg","Pi
var ImageHolder2 = document.getElementById('R
function RotateImages(whichHolder,S
{
var a = eval("ImageArr"+whichHolde
var b = eval("ImageHolder"+whichHo
if(Start>=a.length)
Start=0;
b.src = a[Start];
window.setTimeout("RotateI
}
RotateImages(1,0);
RotateImages(2,0);
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.