(This post was last modified: 11.11.2013, 00:10 by SlimShady95.)
11.11.2013, 00:10
(10.11.2013, 20:50)tero20051 Wrote: Thats the script that i want to use ...
Code:<script language="JavaScript">
<!--
/*
Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com)
Over 200+ free JavaScripts here!
Updated: 00/04/25
*/
function random_imglink(){
var myimages=new Array()
//specify random images below. You can have as many as you wish
myimages[1]="snob.png"
myimages[2]="spear.png"
myimages[3]="spy.png"
myimages[4]="paladin.png"
myimages[5]="sword.png"
myimages[6]="archer.png"
//specify corresponding links below
var imagelinks=new Array()
imagelinks[1]="http://www.javascriptkit.com"
imagelinks[2]="http://www.netscape.com"
imagelinks[3]="http://www.microsoft.com"
imagelinks[4]="http://www.dynamicdrive.com"
imagelinks[5]="http://www.freewarejava.com"
imagelinks[6]="http://www.cnn.com"
var ry=Math.floor(Math.random()*myimages.length)
if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>')
}
random_imglink()
//-->
</script>
Why don´t you do that with php?
PHP Code:
$imgs[0]="snob.png";
$imgs[1]="spear.png";
$imgs[2]="spy.png";
$imgs[3]="paladin.png";
$imgs[4]="sword.png";
$imgs[5]="archer.png";
$links[0]="http://www.javascriptkit.com";
$links[1]="http://www.netscape.com";
$links[2]="http://www.microsoft.com";
$links[3]="http://www.dynamicdrive.com";
$links[4]="http://www.freewarejava.com";
$links[5]="http://www.cnn.com";
$rand = rand(0, count($imgs) - 1);
print '<a href="' . $links[$rand] . '"><img src="' . $imgs[$rand] . '" border="0"></a>';
MfG Manuel