<script language="JavaScript" type="text/javascript">
var imagen1 = 1;
var RotatingImage1_Images = new Array(5);
RotatingImage1_Images[1] = "imagesnes/lala.png";
RotatingImage1_Images[2] = "imagesnes/lala.png";
var RotatingImage1_URLs = new Array(5);
RotatingImage1_URLs[1] = "http://www.link.com";
RotatingImage1_URLs[2] = "http://www.link.com";
var RotatingImage1_Targets = new Array(5);
RotatingImage1_Targets[1] = "_blank";
RotatingImage1_Targets[2] = "_blank";
function RotatingImage1ShowNext()
{
RotatingImage1_Index = RotatingImage1_Index + 1;
if (RotatingImage1_Index > 5)
RotatingImage1_Index = 1;
eval("document.RotatingImage1.src = RotatingImage1_Images[" + RotatingImage1_Index + "]");
setTimeout("RotatingImage1ShowNext();", 1000);
}
function onRotatingImage1Click()
{
if (RotatingImage1_Targets[RotatingImage1_Index] == "")
{
targetwin = "_self";
}
else
{
targetwin = RotatingImage1_Targets[RotatingImage1_Index];
}
eval("window.open(url = RotatingImage1_URLs[" + RotatingImage1_Index + "],'" + targetwin +"');");
}
</script>
<? $azar = rand(1,2);
if($azar == 1) {
$imagen = "imagen/lala.png";
$url = "http://link.com";
}elseif($azar == 2) {
$image = "imagen/lala.png";
$url = "http://link.com";
}?>
Con esto haces la funcion para que la imagen valla rotando y editas las imagenes y los links y en donde tu quieres que salga pones lo siguiente:
<a href="<?=$url;?>" target="_blank"><img src="<?=$image;?>" id="RotatingImage1" border="0" align="top" alt="" width="400" height="150" name="RotatingImage1"></a>
Obviamente hay maneras mas cortas, ahora este codigo yo no lo hice, lo eh sacado de un source, para dartelo debido a que yo en cuanto a javascript recien estoy empezando al 100% para entenderlo, pero si itenes alguna duda, igual me puedes preguntar ya que entiendo el codigo, ojalas te allá ayudado.