Mostrar imagen grande en galeria de imagenes
He creado una galeria de imgenes y quiero que al pinchar en la foto esta se haga ms grande. Pero no consigo mostrar la foto en grande te paso el código a ver si me puedes "echar una mano". Gracias
<!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=iso-8859-1" />
<title>Galeria Javascript</title>
<script language="javascript">
//Array en la que debemos incluir
// la ruta a todas las imágenes de nuestro album
var misImagenes= new Array(3)
misImagenes [0]= "celtiberos/1.jpg";
misImagenes [1]= "celtiberos/5.jpg";
misImagenes [2]= "celtiberos/3.jpg";
misImagenes [3]= "celtiberos/4.jpg";
var i = 0;
//funcion de carga de la primera imagen
function cargarImagen(){
document.imgSrc.src = misImagenes ;
}
function anterior(){
if(i<1){
var NumImagen = i
} else {
var NumImagen = i-=1;
}
document.imgSrc.src = misImagenes[NumImagen];
}
function siguiente(){
if(i>2){
var NumImagen = i
} else {
var NumImagen = i+=1;
}
document.imgSrc.src = misImagenes[NumImagen];
}
//Llamar a la función
window.onload=cargarImagen;
</script>
<style type="text/css">
body {
margin-top:40px;
}
td a {
font:9px Verdana, Arial, Helvetica, "sans-serif";
color:#FFFFFF;
text-decoration:none;
}
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script>
PositionX = 100;
PositionY = 100;
defaultWidth = 500;
defaultHeight = 500;
var AutoClose = true;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width=512,height=368,left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=512,height=368,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Cargando ...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=520;');
writeln('height=400;');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["imagenes"].width;');writeln('window.innerHeight=document.images["imagenes"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="imagenes" src='+imageURL+' style="display:block"></body></html>');
close();
}}
</script>
</head>
<body>
<div id="Layer2" style="position:absolute; left:28px; top:90px; width:144px; height:91px; z-index:2">
<img src="imgSrc" alt="ImÁgenes de la galeria" name="imgSrc" width="331" height="257" id="imgSrc" onclick="onclick=popImage('imgSrc','Texto alt') " ></div>
<div id="Layer1" style="position:absolute; left:15px; top:359px; width:381px; height:38px; z-index:3">
<table width="400" border="1" cellspacing="0" cellpadding="0" style="background:#666; width:400px; margin: auto;">
<tr>
<td align="center"><a href="#" onclick="anterior();"> < Anterior</a></td>
<td align="center"><a href="#" onclick="siguiente();">Siguiente > </a></td>
</tr>
</table>
</div>
<div style="width:400px; height:300px; margin: auto;"> </div>
</body>
</html>
<!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=iso-8859-1" />
<title>Galeria Javascript</title>
<script language="javascript">
//Array en la que debemos incluir
// la ruta a todas las imágenes de nuestro album
var misImagenes= new Array(3)
misImagenes [0]= "celtiberos/1.jpg";
misImagenes [1]= "celtiberos/5.jpg";
misImagenes [2]= "celtiberos/3.jpg";
misImagenes [3]= "celtiberos/4.jpg";
var i = 0;
//funcion de carga de la primera imagen
function cargarImagen(){
document.imgSrc.src = misImagenes ;
}
function anterior(){
if(i<1){
var NumImagen = i
} else {
var NumImagen = i-=1;
}
document.imgSrc.src = misImagenes[NumImagen];
}
function siguiente(){
if(i>2){
var NumImagen = i
} else {
var NumImagen = i+=1;
}
document.imgSrc.src = misImagenes[NumImagen];
}
//Llamar a la función
window.onload=cargarImagen;
</script>
<style type="text/css">
body {
margin-top:40px;
}
td a {
font:9px Verdana, Arial, Helvetica, "sans-serif";
color:#FFFFFF;
text-decoration:none;
}
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<script>
PositionX = 100;
PositionY = 100;
defaultWidth = 500;
defaultHeight = 500;
var AutoClose = true;
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width=512,height=368,left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=512,height=368,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Cargando ...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=520;');
writeln('height=400;');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["imagenes"].width;');writeln('window.innerHeight=document.images["imagenes"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=ffffff scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="imagenes" src='+imageURL+' style="display:block"></body></html>');
close();
}}
</script>
</head>
<body>
<div id="Layer2" style="position:absolute; left:28px; top:90px; width:144px; height:91px; z-index:2">
<img src="imgSrc" alt="ImÁgenes de la galeria" name="imgSrc" width="331" height="257" id="imgSrc" onclick="onclick=popImage('imgSrc','Texto alt') " ></div>
<div id="Layer1" style="position:absolute; left:15px; top:359px; width:381px; height:38px; z-index:3">
<table width="400" border="1" cellspacing="0" cellpadding="0" style="background:#666; width:400px; margin: auto;">
<tr>
<td align="center"><a href="#" onclick="anterior();"> < Anterior</a></td>
<td align="center"><a href="#" onclick="siguiente();">Siguiente > </a></td>
</tr>
</table>
</div>
<div style="width:400px; height:300px; margin: auto;"> </div>
</body>
</html>
1 respuesta
Respuesta de Marcelo Origoni
1