Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2006, 05:07
Karmico
 
Fecha de Ingreso: abril-2005
Mensajes: 13
Antigüedad: 19 años, 10 meses
Puntos: 0
Mostrar Ocultar TIPOS de Capas!! No es lo que parece...

Hola a todos,

resulta que necesito la siguiente aplicación en javascript, y estoy hecho un lio. Necesito que, a traves de unos enlaces llamados ESPAÑOL, INGLES, ALEMAN (asi hasta nueve idiomas...) mostrar u ocultar un grupo de capas que pertenecen a ese idioma....

Aqui va el codigo...

<html>
<head>
<script type="text/javascript">
function MostrarIdioma(idioma) {
// COMO DEBE FUNCIONAR: OCULTAR TODAS LAS CAPAS DE IDIOMAS PARA LUEGO MOSTRAR LA DEL IDIOMA SELECCIONADO
var elementos = document.getElementByID('lang');
elementos.style.display = "none";

var elementos2 = document.getElementsByName(idioma);
for (i = 0; i< elementos2.length; i++) {
if(navigator.appName.indexOf("Microsoft") > -1){
var visible = 'block'
} else {
var visible = 'table-row';
}
elementos2[i].style.display = visible;
}
}
</script>
</head>
<body>

<a href="javascript:MostrarIdioma('es')">Español</a> | <A href="javascript:MostrarIdioma('en')">Ingles</a><br>

<div name="es" id="lang">ESTA ES LA CAPA DE ESPAÑOL 1</div>
<div name="es" id="lang">ESTA ES LA CAPA DE ESPAÑOL 2</div>
<div name="en" id="lang" style="display:none;">ESTA ES LA CAPA DE INGLES 1</DIV>
<div name="en" id="lang" style="display:none;">ESTA ES LA CAPA DE INGLES 2</DIV>
<div name="al" id="lang" style="display:none;">ESTA ES LA CAPA DE ALEMAN 1</DIV>
<div name="al" id="lang" style="display:none;">ESTA ES LA CAPA DE ALEMAN 2</DIV>

</body>
</html>
Como es obvio, el codigo no me funciona....

Gracias por vuestra ayuda!!!!