PDA

View Full Version : compatibility with netscape!!


usban
09-14-2002, 12:55 AM
I'm using this code in my web page and it works perfectly, but when i've tried it in a Netcape browser i've seen that it doen't work. I don't know where is the problem or which is the property that netscape doesn't support. I would like to know i i can do something similar to that in netscape and how.

<html>
</head>
<script>
function oculta(id)
{
obj = eval(id);
if(obj.style.display == "none")
{
obj.style.display = "";
}
else
{
obj.style.display = "none";
}
}
</script>
</head>
<body>
<ul>
<li> <a href="javascript:oculta(tab)"> tablas </a> </li>
<ul style="display:none" id="tab">
<li> 1 </li>
<li> 2 </li>
</ul>
</ul>
</body>
</html>

adios
09-14-2002, 01:28 AM
Hope you mean NS6/7...

<html>
</head>
<script>

function oculta(id) {
var obj = document.getElementById ? document.getElementById(id) :
document.all ? document.all(id) : null;
if (obj && obj.style) obj.style.display = (obj.style.display == 'none') ? '' : 'none';
}

</script>
</head>
<body>
<ul>
<li>
<a href="javascript:void oculta('tab')"> tablas </a></li>
<ul style="display:none;" id="tab">
<li> 1 </li>
<li> 2 </li>
</ul>
</ul>
</body>
</html>