Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/05/2014, 04:09
rocalcha
 
Fecha de Ingreso: mayo-2014
Mensajes: 1
Antigüedad: 10 años
Puntos: 0
galeria de imagenes con enlaces

Hola aver si me podeis ayudar soy nueva en javascript y tengo que realizar una galeria de imagenes donde aparezca el titulo de la imagen debajo de esta y un enlace en cada imagen a una web. me falta realizar lo último que cuando salga una imagen pinchar en ella y que salga el enlace a la web. esto con cada imagen. me podeis ayudar no se como hacerlo.





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Pase de diapositivas</title>
<script type="text/javascript">
var i = 0;
var path = new Array();

// LIST OF SLIDES
path[0] = "imagen1.jpg";
path[1] = "imagen2.jpg";
path[2] = "imagen3.jpg";

var k = path.length-1;

var caption = new Array();
// LIST OF CAPTİONS

caption[0] = "The Time Through Ages.";
caption[1] = "In the Name of Allah, Most Gracious, Most Merciful.";
caption[2] = "1. By the Time, ";

var enlace = new Array();
//LIST OF URLs

enlace[0] = "http://url"
enlace[1] = "http://url"
enlace[2] = "http://url/"
enlace[3] = "http://url/"




function swapImage(){
var el = document.getElementById("mydiv");
el.innerHTML=caption[i];
var img= document.getElementById("slide");
img.src= path[i];





if(i < k ) { i++;}
else { i = 0; }
setTimeout("swapImage()",5000);
// alert(document.body.innerHTML);

}

// Multiple onload function written by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent(function() {
swapImage();
});
</script>
</head>
<body>
<img name="slide" id="slide" alt ="my images" height="130" width="770" src="images/law1.jpg"/>
<div id ="mydiv"></div>

</body>
</html>