PDA

View Full Version : PHP Or Javascript Banner Randomizer?



iRoss
12-06-2005, 09:36 AM
Hey,

Im looking for 1 of those random image things.
Wether it be PHP or Javascript. I don't mind.

I know Mentor did a thread on this but i can't find it :P

Thanks :rolleyes:

Rix
12-06-2005, 10:07 AM
cuteandpastescripts have a random text program

iRoss
12-06-2005, 10:21 AM
>:I I said random image.

Rix
12-06-2005, 10:33 AM
yeah i think they hav that 2

iRoss
12-06-2005, 10:36 AM
Hmm. Id rather it didn't have to go to a website to get it because it will just take longer to load the page... That's why i asked for Javascript Or PHP.

Michael.
12-06-2005, 10:36 AM
Hang on - Anderman has one, I'll nick the code off him now :p!

iRoss
12-06-2005, 10:40 AM
Rofl Cheers mate :D

Mentor
12-06-2005, 02:16 PM
http://habboxforum.com/showthread.php?t=45838

has a dinamcily ranom banner. or just a php one could work simply on the same basis


<?php
//image arrays
// just ad decres it to remove images, also chnage image1.gif etc to images you wnat to dimainc image to randomize "/
$stuff = array (
0 => "image1.gif",
1 => "image2.gif",
2 => "image3.gif",
);
$display=rand(0, sizeof($stuff)-1);

//write banner
echo "<img src='".$stuff[$display]."'>";

?>


or if you would prefer javascript



<SCRIPT LANGUAGE="javascript">

banners = new Array()
banners[0]="image.gif"
banners[1]="image2.gif"
banners[2]="image3.gif"


var Number = Math.round(2 * Math.random());


var TheImage = banners[Number]

document.write("<img scr='" +TheImage+ "'>")

</SCRIPT>

Anderman
12-06-2005, 06:07 PM
I got mine of
javascript.internet.com

iRoss
12-06-2005, 07:53 PM
http://habboxforum.com/showthread.php?t=45838

has a dinamcily ranom banner. or just a php one could work simply on the same basis


<?php
//image arrays
// just ad decres it to remove images, also chnage image1.gif etc to images you wnat to dimainc image to randomize "/
$stuff = array (
0 => "image1.gif",
1 => "image2.gif",
2 => "image3.gif",
);
$display=rand(0, sizeof($stuff)-1);

//write banner
echo "<img src='".$stuff[$display]."'>";

?>


or if you would prefer javascript



<SCRIPT LANGUAGE="javascript">

banners = new Array()
banners[0]="image.gif"
banners[1]="image2.gif"
banners[2]="image3.gif"


var Number = Math.round(2 * Math.random());


var TheImage = banners[Number]

document.write("<img scr='" +TheImage+ "'>")

</SCRIPT>



Yaysie :D Thanks Mentor. And Anders ofcourse :D

Just to let you know it worked :D Yay ;D

Want to hide these adverts? Register an account for free!