Can someone please mod this code so that it will display 6 random affiliates at a time, nothing more and nothing less, and can someone please mod the code so that it will not display the same affiliate twice. Please and Thank you![]()
Code:
- <script type="text/javascript">
- /*Random Affiliate Display*/
- /*Only Edit Below*/
- var affiliates = Array();
- affiliates[1] = Array('http://heartwrrr.proboards82.com', 'http://i25.photobucket.com/albums/c51/dog199200/Digimon/untitled-1.gif', 'Digimon Shadows');
- affiliates[2] = Array('http://dog1992.proboards20.com', 'http://i25.photobucket.com/albums/c51/dog199200/Inuyasha%20Images/inuyashaye8.gif', 'Inuyasha World');
- affiliates[3] = Array('http://www.pheonixemerald.proboards83.com', 'http://i25.photobucket.com/albums/c51/dog199200/PE%20%20Images/EmeraldPhoenxaffilaite.gif', 'Phoenix Emerald');
- affiliates[4] = Array('http://itchigobleach.proboards59.com', 'http://i25.photobucket.com/albums/c51/dog199200/53a8hox.gif', 'Bleach Legend Of The Shadow Hollow');
- affiliates[5] = Array('http://fullmetalme.proboards49.com/', 'http://i25.photobucket.com/albums/c51/dog199200/FMA%20Images/FMAAJBanner.gif', 'FMA Advanced Journey');
- affiliates[6] = Array('http://rockleewashere.proboards58.com/index.cgi', 'http://i25.photobucket.com/albums/c51/dog199200/Naruto/403747650_31078d9dbf.gif', 'Naruto Demonic Illusions');
- affiliates[7] = Array('http://omegavampire.proboards57.com/index.cgi?', 'http://i25.photobucket.com/albums/c51/dog199200/Omega%20Blood%20Lust/omegabloodaffiliate.gif', 'Omega Blood Lust');
- affiliates[8] = Array('http://pokemondshelp.proboards62.com', 'http://i25.photobucket.com/albums/c51/dog199200/Pokemon/pokemonaffilaite.png', 'Pokemon DS Help');
- affiliates[9] = Array('http://tengai.proboards46.com/index.cgi', 'http://i25.photobucket.com/albums/c51/dog199200/tengai7ge.png', 'Tengai');
- affiliates[10] = Array('http://hogwartz4.proboards85.com/index.cgi?', 'http://www.geocities.com/phoenixrayne4/hogaffil.png', 'Us Against The World');
- /*Only Edit Above*/
- var rand = Math.floor(Math.random() * affiliates.length);
- for(i=0; i<6; i++) {
- var rand = Math.floor(Math.random() * affiliates.length);
- document.write('<a href="'+ affiliates[rand][0] +'"><img src="'+ affiliates[rand][1] +'" alt="'+ affiliates[rand][2] +'" /></a>');
- }
- </script>
P.S. If you need help with what is what in the code either ask Ross because it is his code or just ask me. I know what does what in the coce, I just dont have enough coding knowledge to do the changes myself.
Try this...
Code:
- <script type="text/javascript">
- /*Random Affiliate Display*/
- /*Only Edit Below*/
- var affiliates = Array();
- affiliates[1] = Array('http://heartwrrr.proboards82.com', 'http://i25.photobucket.com/albums/c51/dog199200/Digimon/untitled-1.gif', 'Digimon Shadows');
- affiliates[2] = Array('http://dog1992.proboards20.com', 'http://i25.photobucket.com/albums/c51/dog199200/Inuyasha%20Images/inuyashaye8.gif', 'Inuyasha World');
- affiliates[3] = Array('http://www.pheonixemerald.proboards83.com', 'http://i25.photobucket.com/albums/c51/dog199200/PE%20%20Images/EmeraldPhoenxaffilaite.gif', 'Phoenix Emerald');
- affiliates[4] = Array('http://itchigobleach.proboards59.com', 'http://i25.photobucket.com/albums/c51/dog199200/53a8hox.gif', 'Bleach Legend Of The Shadow Hollow');
- affiliates[5] = Array('http://fullmetalme.proboards49.com/', 'http://i25.photobucket.com/albums/c51/dog199200/FMA%20Images/FMAAJBanner.gif', 'FMA Advanced Journey');
- affiliates[6] = Array('http://rockleewashere.proboards58.com/index.cgi', 'http://i25.photobucket.com/albums/c51/dog199200/Naruto/403747650_31078d9dbf.gif', 'Naruto Demonic Illusions');
- affiliates[7] = Array('http://omegavampire.proboards57.com/index.cgi?', 'http://i25.photobucket.com/albums/c51/dog199200/Omega%20Blood%20Lust/omegabloodaffiliate.gif', 'Omega Blood Lust');
- affiliates[8] = Array('http://pokemondshelp.proboards62.com', 'http://i25.photobucket.com/albums/c51/dog199200/Pokemon/pokemonaffilaite.png', 'Pokemon DS Help');
- affiliates[9] = Array('http://tengai.proboards46.com/index.cgi', 'http://i25.photobucket.com/albums/c51/dog199200/tengai7ge.png', 'Tengai');
- affiliates[10] = Array('http://hogwartz4.proboards85.com/index.cgi?', 'http://www.geocities.com/phoenixrayne4/hogaffil.png', 'Us Against The World');
- /*Only Edit Above*/
- for(i=0; i<6; i++) {
- var rand = Math.floor(Math.random() * affiliates.length);
- document.write('<a href="'+ affiliates[rand][0] +'"><img src="'+ affiliates[rand][1] +'" alt="'+ affiliates[rand][2] +'" /></a>');
- affiliates.splice(rand, 1);
- }
- </script>
its a little better, now it dont show doubles but it still show under 6 at a time..thx for your help
How many does it show each time?![]()
its max is set to 6 but it jumps from showing none to showing 6, but not in that order, it may go from like 2 to 4 to 1, being displayed
http://phoenixemerald.virtualforums.co.uk/
that site is an example but its max display is set to 8
your array has to start at 0 not 1.
Simply change 10 to 0 and it'll work fine![]()
hey ty i got the code from ross with the array being off, i didn't think about fixing it.
![]()
It's ok...
All working now?
yep is it...now with a few more mods i can summit my custom info center into the database