Jump to content

Code for randomised images? [jcink]


Rivfader
 Share

Recommended Posts

I'm basically looking for a code that'd randomise the images under 'Wanted Characters' (example - take a moment to admire that beautiful red oval) whenever someone refreshes the page, because that'd allow me to display more than just four characters at any given time. I'm not sure how to do it myself, but I've seen it done for banners and things, so I'm hoping it isn't too awkward a thing to do.

 

Any help would be appreciated! 

 

Edited by Raksha

rsz_nightborn_signature.png.49b292d20e17d3c29707bfecdb8bb800.png

Link to comment
Share on other sites

  • Admin
<script type="text/javascript">
//From RPG Initiative
var randwant = [],
index = 0;

randwant[0] = "<a href = 'URL'><img src='URL' alt='ALT-TITLE'></a>";
randwant[1] = "<a href = 'URL'><img src='URL' alt='ALT-TITLE'></a>";
randwant[2] = "<a href = 'URL'><img src='URL' alt='ALT-TITLE'></a>";

index = Math.floor(Math.random() * randwant.length);
document.write(randwant[index]);
//done
</script>

If you want more than one this won't work but I can help you with that if that's what you need but this will do what you are looking for.

  • I read this! 1

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Thanks so much, Morrigan! I'm not the most skilled with coding, though, so I'm going to need a little advice on how to implement that script. o:

 

This is basically what the current code looks like. Would I be replacing it with yours, orrrr? 

 

 

 

<td><div class="wantad"><a href="http://valour.jcink.net/index.php?showtopic=241"><img src="https://s32.postimg.org/e7vm7oomt/rsz_1rsz_f463d8d2e69209cf798a9622edd70267_Croppe.jpg"/></a></div></td>

<td><div class="wantad"><a href="http://valour.jcink.net/index.php?showtopic=145"><img src="https://s31.postimg.org/g8imrvqij/rsz_thorin_at_world_s_end_by_mirielofgisborne_d8.jpg"/></a></div></td>

<td><div class="wantad"><a href="http://valour.jcink.net/index.php?&act=ST&f=6&t=139"><img src="https://s31.postimg.org/wfmsniqzv/rsz_ichabod_crane_ichabod_crane_sleepy_hollow_tv.png"/></a></div></td>

<td><div class="wantad"><a href="http://valour.jcink.net/index.php?showtopic=198"><img src="https://s32.postimg.org/6l9a56tx1/rsz_1600904e1654a1523ae5d24a7882bbf74_Cropped.jpg"/></a></div></td>

 

 

 

Edited by Mephala

rsz_nightborn_signature.png.49b292d20e17d3c29707bfecdb8bb800.png

Link to comment
Share on other sites

  • Admin

It depends on how you want it to work. If you want it to be random per column (so that it's four different images every time) then we'll have to update it all a little bit.

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

What I'm looking for is for each of the four images to have another image that it'll be able to change to. So, eight in total. 

rsz_nightborn_signature.png.49b292d20e17d3c29707bfecdb8bb800.png

Link to comment
Share on other sites

Less HTML based, and more just kind of, random images, you can make randomizers at this site http://www.imgweave.com/ . Then just generic link to the wanted ad section, and not specifically those characters. Just an option if the scripting gets too intense.

LAMSig.png.4a4090b379562b2600cc05eefdbfa826.png

 

 

Link to comment
Share on other sites

That works beautifully, mellomeme! Thanks so much! And thank you Morrigan as well. <3

  • I read this! 2

rsz_nightborn_signature.png.49b292d20e17d3c29707bfecdb8bb800.png

Link to comment
Share on other sites

  • 5 weeks later...

 

@Morrigan, I tried to use it too and it doesn't show any image. What did I do wrong?

 

I mean, something had happened, because I tried to use the one you gave me before (by Computerwave or something) and it didn't work, but then I suspected that it was something I had messed with a bad edit/ replace in a text. So I took the new code from here, I replaced the pictures and links... and it still doesn't work. :( Please, help!


<script type="text/javascript">
//From RPG Initiative
var images = [],
index = 0;

randwant[0] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=2730' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Louise_zps4uzuxcqi.jpg' border='0' alt=' photo Louise_zps4uzuxcqi.jpg'/></a>";

randwant[1] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=573' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Christine_zpsqflbrpdz.jpg' border='0' alt=' photo Christine_zpsqflbrpdz.jpg'/></a>";

randwant[2] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=17' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/raoul_zpsjvs6fksi.jpg' border='0' alt=' photo raoul_zpsjvs6fksi.jpg'/></a>";

randwant[3] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=236' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Lucia_zpsjkgyitwl.jpg' border='0' alt=' photo Lucia_zpsjkgyitwl.jpg'/></a>";

randwant[4] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1366' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Madeleine_zpsyrtgr2hq.jpg' border='0' alt=' photo Madeleine_zpsyrtgr2hq.jpg'/></a>";

randwant[5] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1206' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Dianne_zps828vn5ql.jpg' border='0' alt=' photo Dianne_zps828vn5ql.jpg'/></a>";

randwant[6] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=111' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/leon_zps9otyzajy.jpg' border='0' alt=' photo leon_zps9otyzajy.jpg'/></a>";

randwant[7] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=664' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Mora_zps3pxukbr2.jpg' border='0' alt=' photo Mora_zps3pxukbr2.jpg'/></a>";

randwant[8] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1975' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Privateers/Valerian_zpsix4xepgw.jpg' border='0' alt='photo Valerian_zpsix4xepgw.jpg'/></a>";

randwant[9] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3203' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Eli_zpsny4rz1ee.jpg' border='0' alt=' photo Eli_zpsny4rz1ee.jpg'/></a>";

randwant[10] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=196' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Gaspard_zpsavft8aa9.jpg' border='0' alt=' photo Gaspard_zpsavft8aa9.jpg'/></a>"; 

randwant[11] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=574' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/JASMINE_zpszmkyxev7.jpg' border='0' alt=' photo JASMINE_zpszmkyxev7.jpg'/></a>";
 randwant[12] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=22' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Nicole_zpse2q0r3ri.jpg' border='0' alt=' photo Nicole_zpse2q0r3ri.jpg'/></a>";

randwant[13] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=112' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Phillipe_zpsl8urriw4.jpg' border='0' alt=' photo Phillipe_zpsl8urriw4.jpg'/></a>";

randwant[14] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3014' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/SeraphineEgron_zpsytozv7qn.jpg' border='0' alt=' photo SeraphineEgron_zpsytozv7qn.jpg'/></a>";

randwant[15] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=256' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Jacqueline_zpsmvzfjimv.jpg' border='0' alt=' photo Jacqueline_zpsmvzfjimv.jpg'/></a>";

randwant[16] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=135' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Gilbert_zps4395fuh7.jpg' border='0' alt=' photo Gilbert_zps4395fuh7.jpg'/></a>"; 

randwant[17] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3124' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/JudithMatthieu_zpsbkprbvnx.jpg' border='0' alt=' photo JudithMatthieu_zpsbkprbvnx.jpg'/></a>";

randwant[18] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=575' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Alain_zpsjhxrajm1.jpg' border='0' alt=' photo Alain_zpsjhxrajm1.jpg'/></a>";

randwant[19] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=136' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Babkak_zpsxvymn4dq.jpg' border='0' alt=' photo Babkak_zpsxvymn4dq.jpg'/></a>";

randwant[20] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=115' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Adrien_zpsr8b4ivb5.jpg' border='0' alt=' photo Adrien_zpsr8b4ivb5.jpg'/></a>";

randwant[22] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=301' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Frederic_zpsyvycukds.jpg' border='0' alt=' photo Frederic_zpsyvycukds.jpg'/></a>";

randwant[23] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=150' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Esther_zpspkcuhpe1.jpg' border='0' alt=' photo Esther_zpspkcuhpe1.jpg'/></a>";

index = Math.floor(Math.random() * randwant.length);
document.write(randwant[index]);
//done
</script>
Edited by Elena
Link to comment
Share on other sites

  • Admin

I totes mistyped the top part but this should work:

<script type="text/javascript">
//From RPG Initiative
var randwant = [],
index = 0;

randwant[0] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=2730' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Louise_zps4uzuxcqi.jpg' border='0' alt=' photo Louise_zps4uzuxcqi.jpg'/></a>";

randwant[1] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=573' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Christine_zpsqflbrpdz.jpg' border='0' alt=' photo Christine_zpsqflbrpdz.jpg'/></a>";

randwant[2] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=17' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/raoul_zpsjvs6fksi.jpg' border='0' alt=' photo raoul_zpsjvs6fksi.jpg'/></a>";

randwant[3] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=236' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Lucia_zpsjkgyitwl.jpg' border='0' alt=' photo Lucia_zpsjkgyitwl.jpg'/></a>";

randwant[4] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1366' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Madeleine_zpsyrtgr2hq.jpg' border='0' alt=' photo Madeleine_zpsyrtgr2hq.jpg'/></a>";

randwant[5] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1206' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Dianne_zps828vn5ql.jpg' border='0' alt=' photo Dianne_zps828vn5ql.jpg'/></a>";

randwant[6] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=111' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/leon_zps9otyzajy.jpg' border='0' alt=' photo leon_zps9otyzajy.jpg'/></a>";

randwant[7] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=664' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Mora_zps3pxukbr2.jpg' border='0' alt=' photo Mora_zps3pxukbr2.jpg'/></a>";

randwant[8] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=1975' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Privateers/Valerian_zpsix4xepgw.jpg' border='0' alt='photo Valerian_zpsix4xepgw.jpg'/></a>";

randwant[9] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3203' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Eli_zpsny4rz1ee.jpg' border='0' alt=' photo Eli_zpsny4rz1ee.jpg'/></a>";

randwant[10] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=196' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Gaspard_zpsavft8aa9.jpg' border='0' alt=' photo Gaspard_zpsavft8aa9.jpg'/></a>"; 

randwant[11] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=574' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/JASMINE_zpszmkyxev7.jpg' border='0' alt=' photo JASMINE_zpszmkyxev7.jpg'/></a>";
 randwant[12] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=22' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Nicole_zpse2q0r3ri.jpg' border='0' alt=' photo Nicole_zpse2q0r3ri.jpg'/></a>";

randwant[13] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=112' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Phillipe_zpsl8urriw4.jpg' border='0' alt=' photo Phillipe_zpsl8urriw4.jpg'/></a>";

randwant[14] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3014' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/SeraphineEgron_zpsytozv7qn.jpg' border='0' alt=' photo SeraphineEgron_zpsytozv7qn.jpg'/></a>";

randwant[15] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=256' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Jacqueline_zpsmvzfjimv.jpg' border='0' alt=' photo Jacqueline_zpsmvzfjimv.jpg'/></a>";

randwant[16] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=135' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Gilbert_zps4395fuh7.jpg' border='0' alt=' photo Gilbert_zps4395fuh7.jpg'/></a>"; 

randwant[17] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=3124' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/JudithMatthieu_zpsbkprbvnx.jpg' border='0' alt=' photo JudithMatthieu_zpsbkprbvnx.jpg'/></a>";

randwant[18] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=575' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Alain_zpsjhxrajm1.jpg' border='0' alt=' photo Alain_zpsjhxrajm1.jpg'/></a>";

randwant[19] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=136' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Babkak_zpsxvymn4dq.jpg' border='0' alt=' photo Babkak_zpsxvymn4dq.jpg'/></a>";

randwant[20] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=115' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Adrien_zpsr8b4ivb5.jpg' border='0' alt=' photo Adrien_zpsr8b4ivb5.jpg'/></a>";

randwant[22] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=301' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Frederic_zpsyvycukds.jpg' border='0' alt=' photo Frederic_zpsyvycukds.jpg'/></a>";

randwant[23] = "<a href='http://beforethemast.b1.jcink.com/index.php?showtopic=150' target='_blank'><img src='http://i925.photobucket.com/albums/ad96/l_elena_r/Port%20de%20Paix/Esther_zpspkcuhpe1.jpg' border='0' alt=' photo Esther_zpspkcuhpe1.jpg'/></a>";

index = Math.floor(Math.random() * randwant.length);
document.write(randwant[index]);
//done
</script>

 

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Yes, it works, thank you! <3

  • I read this! 1
Link to comment
Share on other sites

  • Admin

Not a problem. Thank you Elena. <33

  • I read this! 1

0_mainsignature.jpg

image.png

Profile set made by myself and original Artwork by Fae Merriman, my daughter.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.