Current location: Hot Scripts Forums » General Web Coding » JavaScript » Is it possible to rebuild image rotation javascript to perform similar, but at the sa


Is it possible to rebuild image rotation javascript to perform similar, but at the sa

Reply
  #1 (permalink)  
Old 05-05-06, 05:11 AM
RomanRusso RomanRusso is offline
New Member
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Is it possible to rebuild image rotation javascript to perform similar, but at the sa

Hie,
Thanks for opportunity to ask this questions.
Here is the nice page where person without particular knowledge of javascript can find image rotation javascript http://www.dyn-web.com/javascript/
Everything is all right on that page, but I am looking for something a bit different. I am planning to create a page where there will be some number of images, which are absolutely identical in size (170x170). Those images will be compiled into html table. It is very simple, even I can do it. Than I am implementing my first javascript which will show large image when mouseover the respective thumb. So also I would like to have another javascript which would rotate those identical images around the html table. This differen from just rotation, I would call it random placement. Is it possible at all? I was unable to find any relevant info online.
Please, GURUS, help
Thanks very much in advance
P.S. hope you understood what I mean. Images should appear in different part of the table every time the page is loaded.
Reply With Quote
  #2 (permalink)  
Old 05-05-06, 01:36 PM
shadowsong shadowsong is offline
Newbie Coder
 
Join Date: May 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
if i am understanding you correctly, the following should do the trick.. it's just an idea.. im too lazy to write the code..
  • Create an array of the images.. ie name of the files
  • Create a temp array to store what has shown already
  • Label your <img> elements in your HTML tables with the "id" attribute.. make the names systematic like "thumb01" or "thumb02"... "thumb10" so forth. and leave their "src" attribute out.
  • use a loop to loop through the number of those thumbnails.. (say you have 20, the loop 20 times).. pick a random element from the image list array.. then do soemthing like this: document.getElementById('thumb' + i).src = the random image you picked out from the array. Then MOVE that SAME image to the temp array so that it woudnlt be shown again.
  • once it's done, move all the shown images array back to the image list and settimeout for the function to execute again so it would do another random placement.

good luck!

EDIT: i might also add that this method is pretty static... i wouldn't use it if you have arbitrary about of images and are constantly adding and removing the images..

Last edited by TwoD; 05-06-06 at 02:35 PM. Reason: Merged posts.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Rotation Script RTAdams89 Script Requests 4 04-01-06 06:11 PM
image rotation pkcidstudio JavaScript 4 03-08-06 08:26 AM
There is a problem with use javascript change image boder color mgccla JavaScript 1 10-21-05 09:15 AM
Random Image Rotation mikeyfaces Script Requests 0 10-09-05 01:48 PM
using javascript in php for image changing with drop down menu developer_x PHP 0 02-13-05 08:26 AM


All times are GMT -5. The time now is 11:09 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.