Need script for image rotation

Status
Not open for further replies.

Car Guy

Super Moderator
#1
Well after several hours and many trials and errors I still don't have what I need.

I have several images that I want to automatically rotate sequentially every few seconds, but not on page load only. I found one that was easy to use and worked great, but it was not very "clean".

Does anybody have something for me?

Thanks :)
 

Car Guy

Super Moderator
#4
Thanks Christina, I did check them out but was hoping for a simpler setup, but I got it working.

OK, I got a script and got it working for the most part. I'm trying to slow it down but I can't seem to find the control for that.

The part in red is what I understand to be the speed of scrolling, but it makes no difference what I put in there. Help!

<div class="marquee" id="mycrawler2"><img
src="http://images/1.jpg"> <img
src="http://images/2.jpg"><img
src="http://images/3.jpg"> <img
src="http://images/4.jpg"></div>
<script type="text/javascript">
marqueeInit({
uniqueid: 'mycrawler2',
style: {
'padding': '2px',
'width': '300px',
'height': '200px'
},
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
direction: 'left',
moveatleast: 2,
neutral: 150,
savedirection: true
});
Upon W3C Validation I get required attribute "ALT" not specified for each image in the array.

How and where do I specify the ALT tag?

Thanks
 
Last edited:

Car Guy

Super Moderator
#6
Yah, I hadn't thought of that, got too many things going on here now. I thought that being a js their was something different I need to do.

Thanks Danny, I'll try that.
 

Car Guy

Super Moderator
#9
Yes it works great.

You need to put this in the <head>
<script type="text/javascript" src="crawler.js">
And then you need to create the crawler.js , that is a lengthy bit of code. PM to you.

EDIT: Don't forget to put in the ALT tags!
 
Last edited:
#11
<script language="JavaScript">
picNr = 0;
pics = new Array("your-image1.jpg",
"your-image2.gif",
"dog.jpg",
"cat.jpg",
"moose.jpg",
"alligator-1.jpg");

function rotatePics(){
document.rotating.src = "images/" + pics[picNr];
if (picNr < pics.length - 1) {
picNr = picNr + 1;
}else{
picNr = 0;
}
setTimeout("rotatePics();",5000);
}
</script>

<body onLoad="rotatePics();">
<img name="rotating" border="0" src="your-image1.jpg">

<!-- 1. Put the <script> and </script> tags (and everything between them) in the <head> section of your page.
2. Copy the <img> tag and paste it where you want the rotating pictures to appear.
3. Copy the onLoad= attribute (and its value), then paste it into the <body> tag in your page.
4. Change the six picture names in the pics array to reflect the names of your pictures. You can specify as many pictures as you like.
5. If necessary, change the path relative path "images/" in two places.
6. To change the rotation frequency, change 5000 to the number of milliseconds you want. For example, 8000 means eight seconds. -->
 
Status
Not open for further replies.
Top