A
ashkaan57
Hi,
I am using the following code to show/hide part of an html page. It
works in Netscape and Firefox but dies in IE: "Error: document.layers
is null or not an object"
<style>
..noshow {
display: none;
}
..menu {
display: block;
}
</style>
<script language="javascript>
if (document.getElementById)
{
function getElemById(id)
{
return document.getElementById(id);
}
}
else if (document.all)
{
function getElemById(id)
{
return document.all(id);
}
}
else if (document.layers)
{
function getElemById(id)
{
return document.layers[id];
}
}
function hide(ele)
{
getElemById(ele).className = "noshow";
}
function show(ele)
{
getElemById(ele).className = "menu";
}
</script>
Then in the html part:
<a href="javascript:show('category');">Show Categories</a>
<div id="category" class="noshow">
....
....
<a href="javascript:hide('category');">Hide Categories</a>
</div>
TIA.
I am using the following code to show/hide part of an html page. It
works in Netscape and Firefox but dies in IE: "Error: document.layers
is null or not an object"
<style>
..noshow {
display: none;
}
..menu {
display: block;
}
</style>
<script language="javascript>
if (document.getElementById)
{
function getElemById(id)
{
return document.getElementById(id);
}
}
else if (document.all)
{
function getElemById(id)
{
return document.all(id);
}
}
else if (document.layers)
{
function getElemById(id)
{
return document.layers[id];
}
}
function hide(ele)
{
getElemById(ele).className = "noshow";
}
function show(ele)
{
getElemById(ele).className = "menu";
}
</script>
Then in the html part:
<a href="javascript:show('category');">Show Categories</a>
<div id="category" class="noshow">
....
....
<a href="javascript:hide('category');">Hide Categories</a>
</div>
TIA.