Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/07/2009, 06:13
Avatar de adexedl
adexedl
 
Fecha de Ingreso: julio-2005
Mensajes: 326
Antigüedad: 19 años, 8 meses
Puntos: 2
Ver y ocultar div´s

Hola amigos,

tengo este código, con el que muestro u oculto div´s según me convenga. El archivo en cuestión lo tengo llamado prueba.html

Código 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=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript">
function show_div(div_id) {
    // hide all the divs
    document.getElementById('the_div_1').style.display = 'none';
    document.getElementById('the_div_2').style.display = 'none';
    document.getElementById('the_div_3').style.display = 'none';

    // show the requested div
    document.getElementById(div_id).style.display = 'block';
}
</script>
</head>

<body>

<a href="" onclick="show_div('the_div_1'); return false;">Div 1</a>
<a href="" onclick="show_div('the_div_2'); return false;">Div 2</a>
<a href="" onclick="show_div('the_div_3'); return false;">Div 3</a>

<div id="the_div_1">This is div 1</div>
<div style="display: none;" id="the_div_2">This is div 2</div>
<div style="display: none;" id="the_div_3">This is div 3</div>

</body>
</html> 
Mi pregunta es la siguiente:

Si por ejemplo yo estoy en una página llamada index.html y quiero que al ir a prueba.html este con el id="the_div_3" abierto, como lo haría ???

Saludos y gracias de antemano
__________________
Diseño Web Canarias