Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/08/2007, 17:21
Avatar de derkenuke
derkenuke
Colaborador
 
Fecha de Ingreso: octubre-2003
Ubicación: self.location.href
Mensajes: 2.665
Antigüedad: 21 años, 3 meses
Puntos: 45
Re: Problema con codigo JScript

Lo he podido solucionar así, lo que pasa es que hay que hacer complejidades con el try y el catch, que siempre es preferible a utilizar la detección del navegador en sí, nos asegura más compatibilidad. Me he basado en la propiedad table-row, como bien ha dicho demiurgo_daemon. La opción de dejarlo en "" (por defecto) no la he probado, pero debería funcionar igualmente.

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<
html>
<
head>
<
title>Untitled</title>
<
script  type="text/javascript">
<!--
function 
mVista(objeto){
    var 
elDisplay objeto.style.display;
    if ( 
elDisplay== "none" ) {
        try {
            
objeto.style.display "table-row";
        }
        catch(
elError) {            // elError es el propio navegador IE...
            
objeto.style.display "block";
        }
    }
    else {
        
objeto.style.display "none";
    }
    return 
false;
}
//-->
</script>

</head>
<body>

<table summary="" align="center" width="140" border="1" bgcolor="#ffffff">
    <tr>
        <td bgcolor="#c0c0c0" align="center">
            <a href="#" onclick='mVista(document.getElementById("Fila1"));'>Principal</a>
        </td>
    </tr>
    <tr id="Fila1" style="display:table-row;">
        <td>
            <div>Opcion1</div>
            <div>Opcion2</div>
            <div>Opcion3</div>
        </td>
    </tr>
</table>

<table summary="" align="center" border="1">
    <tr>
        <td>Hola mundo</td>
    </tr>
</table>


</body>
</html> 


Un saludo.
__________________
- Haz preguntas inteligentes, y obtendrás más y mejores respuestas.
- Antes de postearlo Inténtalo y Búscalo.
- Escribe correctamente tus mensajes.