![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 2
Rep Power: 0
![]() |
Random image array
basically once one of the images is created randomly i want it removed from the array so it cant come up again but for some reason not all the images are appearing anyway heres what ive got whats wrong/missing?
[code]var image=new Array(); var g='.gif'; image[0]='image1'+g; image[1]='image2'+g; image[2]='image3'+g; image[3]='image4'+g; image[4]='image5'+g; var l=image.length; var buff=new Array(); for(i=0;i<l;i++){ buff[i]=new Image(); buff[i].src=image[i]; } var randomNumber=Math.floor(Math.random()*l); for(i=0;i<l;i++){ document.write('<img src="'+image[randomNumber]+'">'); image.splice(randomNumber,1); } |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ADA Random Seed of an Array | scm007 | Other Programming Languages | 1 | Mar 25th, 2007 9:05 PM |
| changing size of an array | Eric the Red | Java | 3 | Apr 3rd, 2006 8:19 PM |
| random numbers in 2D array | cwl157 | Java | 4 | Apr 29th, 2005 6:08 AM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 2:36 AM |
| Checking source codes of image, audio and video files | on_auc | C++ | 3 | Feb 21st, 2005 8:36 PM |