Ver Mensaje Individual
  #14 (permalink)  
Antiguo 31/07/2004, 13:24
Avatar de ferny
ferny
Il capo della mafia
 
Fecha de Ingreso: febrero-2002
Ubicación: Al final del cable
Mensajes: 10.080
Antigüedad: 23 años
Puntos: 55
Te pego aquí el codigo. Esto va entre <head> y </head>

Código:
<script src="galeria.js" language="JavaScript" type="text/javascript"></script>

<script language="javascript">
var op = "vista0";
// Galerías principales
var C2004_0 = new Array();
var C2004_1 = new Array();
var C2004_2 = new Array();
var C2004_3 = new Array();

var vistos = [true, false, false, false];

function IrOp(vista, galeria)	{
	document.getElementById(op).style.display = "none";
	op = vista;
	document.getElementById(op).style.display = "block";
	var actual = parseInt(op.charAt(5));
	if (vistos[actual] == false)	{
		cargar(galeria);
		vistos[actual] = true;
	}
}

</script>
Y ahora el body:

Código:
<p style="text-align: center; width:70%">

<a href="javascript:IrOp('vista0', C2004_0)">[1]</a>
<a href="javascript:IrOp('vista1', C2004_1)">[2]</a>
<a href="javascript:IrOp('vista2', C2004_2)">[3]</a>
<a href="javascript:IrOp('vista3', C2004_3)">[4]</a>

</p>


<div id="vista0" style="display: block">
<script language="javascript" type="text/javascript">

// Carga de fotos
C2004_0[0] = new Foto("IM000267.jpg");
C2004_0[1] = new Foto("IM000268.jpg");
C2004_0[2] = new Foto("IM000269.jpg");

galeria(C2004_0);
cargar(C2004_0);

</script>
<script language="javascript" type="text/javascript" src="1.js"></script>
</div>

<div id="vista1" style="display: none">
<script language="javascript">

// Carga de fotos
C2004_1[0] = new Foto("IM000270.jpg");
C2004_1[1] = new Foto("IM000271.jpg");
C2004_1[2] = new Foto("IM000272.jpg");

galeria(C2004_1);

</script>
<script language="javascript" type="text/javascript" src="2.js"></script>
</div>

<div id="vista2" style="display: none">
<script language="javascript">

// Carga de fotos
C2004_2[0] = new Foto("IM000273.jpg");
C2004_2[1] = new Foto("IM000274.jpg");
C2004_2[2] = new Foto("IM000275.jpg");

galeria(C2004_2);

</script>
<script language="javascript" type="text/javascript" src="1.js"></script>
</div>

<div id="vista3" style="display: none">
<script language="javascript">

// Carga de fotos
C2004_3[0] = new Foto("IM000276.jpg");
C2004_3[1] = new Foto("IM000277.jpg");
C2004_3[2] = new Foto("IM000278.jpg");

galeria(C2004_3);

</script>
<script language="javascript" type="text/javascript" src="2.js"></script>
</div>
Y este es el archivo galeria.js modificado. La función galeria() está así de pruebas nada más, ya la modificare más adelante.

Código:
function Foto(imagen)	{
	this.imagen = imagen;
}

function galeria(fotos)	{
	for (var i = 0; i < fotos.length; i ++)	{
		document.writeln("<img src='' width='150' border='1' id='"+fotos[i].imagen+"'>");
	}
}

function cargar(fotos)	{
	var elemento;
	for (var i = 0; i < fotos.length; i ++)	{
		elemento = fotos[i].imagen;
		document.getElementById(elemento).src = fotos[i].imagen;
	}
}
En cuanto a los archivos 1.js 2.js etc. son los contenidos, que no es más que el texto de la foto escrito de la forma:

Código:
document.write("primera linea<br>");
document.write("segunda linea");
.......
Espero que te sirva, yo aún no he empezado con lo que quiero por falta de time() jejeje...

Saludos
__________________
www.mundodivx.com || www.mundodivx.org

Pon tu mano en un horno caliente durante un minuto y te parecerá una hora.
Siéntate junto a una chica preciosa durante una hora y te parecerá un minuto.
Eso es la relatividad.