![]() |
Re: Simple Image Rotation in JavaScript
Quote:
Any help would be greatly appreciated! |
Re: Simple Image Rotation in JavaScript
Thank you very much for the solution. It works great. Could you please help me to figure out how to use it in case where image comes from CSS? I tried to use an id name but it didn't work..
I was also interested how to make this script load random image instead of rotation every time the page is visited? Thank you. |
Re: Simple Image Rotation in JavaScript
Hi Guys
Can any one tell me how to link to the images when they are in: var ImageArr1 = new Array( "pic1.jpg","pic2.jpg","pic3.jpg"); cheers |
Re: Simple Image Rotation in JavaScript
Thank you for the post i was searching the same . Thank you for your post
|
Re: Simple Image Rotation in JavaScript
Quote:
|
Re: Simple Image Rotation in JavaScript
HTML Code:
<body><a id="imageurl" ><img id="Rotating1" border="0"></img></a><script language="JavaScript"> function RotateImages(Start) { var a = new Array("image1.jpg","image2.jpg","image3.jpg", "image4.jpg"); var c = new Array("url1", "url2", "url3", "url4"); var b = document.getElementById('Rotating1'); var d = document.getElementById('imageurl'); if(Start>=a.length) Start=0; b.src = a[Start]; d.href = c[Start]; window.setTimeout("RotateImages(" + (Start+1) + ")",3000); } RotateImages(0); </script></body>I have additionally embedded the rotating images in a table. The images are of varying sizes. Currently all the images start on the left edge in the table. How do I center these images in the table so that they spring out from the table center? I have used additional table code as below. HTML Code:
</table>HTML Code:
RotateImages(0); |
Re: Simple Image Rotation in JavaScript
I'm pretty limited technically, but was able to get the simple java script, shown below, to work (thank you for sharing it, "Phisolophe").
Now, I'd like to add this functionality - If someone clicks on whatever rotating image is being shown at the moment, they will go to a corresponding unique URL that is associated with that image. (like the rotating image on the Yahoo.com home page works). Could anyone tell me a simple way to add this function to the script shown below? Thanks! <a id="imageurl" ><img id="Rotating1" border="0"></img></a> <script language="JavaScript"> function RotateImages(Start) { var a = new Array("image1.jpg","image2.jpg","image3.jpg", "image4.jpg"); var c = new Array("url1", "url2", "url3", "url4"); var b = document.getElementById('Rotating1'); var d = document.getElementById('imageurl'); if(Start>=a.length) Start=0; b.src = a[Start]; d.href = c[Start]; window.setTimeout("RotateImages(" + (Start+1) + ")",3000); } RotateImages(0); </script> |
| All times are GMT +5.5. The time now is 01:40. |