PDA

View Full Version : Need this scriptttt +rep



Swearwolf
20-08-2008, 02:24 PM
Hey, basically I need a script that I can put on my site that displays a random image, and some text beneath it, that changes like, every 15 seconds or something, it's gonna be for a random room adverts.

+Rep!

Delatory
20-08-2008, 03:17 PM
<script type="text/javascript">
var images = new Array();
images[0]=new Array();
images[0][0]="IMAGE URL HERE";
images[0][1]="TEXT HERE";
images[1]=new Array();
images[1][0]="IMAGE URL HERE #2";
images[1][1]="TEXT HERE #2";

function randimage()
{
var randomnumber=Math.floor((images.length+1)*Math.ran dom());
document.getElementById('image').src = images[randomnumber][0];
document.getElementById('text').innerHTML = images[randomnumber][1];
}

function startrand()
{
randimage();
t=window.setInterval(randimage, "15000");
}
</script>
<body onload="startrand()">
<img src="IMAGE URL HERE" id="image" /><br />
<div id="text"></div>
</body>


Just spent 15 minutes making that :8.
There are probably better ways of doing it but thats one i've just done now.

Calon
20-08-2008, 03:31 PM
http://www.designplace.org/scripts.php?page=1&c_id=13

Google goes a long way.

Simple add " <meta http-equiv="refresh" content="15"/> " to the top or bottom of the script.

Protege
20-08-2008, 08:43 PM
Simple add " <meta http-equiv="refresh" content="15"/> " to the top or bottom of the script.or in the correct area. >_>

Calon
20-08-2008, 09:01 PM
or in the correct area. >_>
It works in any area, not every HTML document has to be strict xHTML. or in place HTML.

Swearwolf
20-08-2008, 09:22 PM
thanks delatroy +rep

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