M
mcheu
Hi,
I'm trying to figure out how to hide text in a DIV block and then hide
and unhide it using javascript. In the code that follows, the message
is initially invisible, and when you click on the "show" link, it's
made visible and pops up bettween the two hyphen lines. When you
click on the "hide" link, it's made invisible again. Or at least
that's what is supposed to happen.
It does all of this just fine in IE5, IE5.5, and IE6. However, in
Mozilla 1.5, the display attribute doesn't get changed, and the
message text remains hidden.
A google search of past postings mentions that this doesn't work in
Netscape 4, but it *is* supposed to work in Netscape 6, which I guess
is approximately equivalent to Mozilla 1.0.
Is there something different I need to do to get this to work in the
Netscape/Mozilla family of browsers?
Thanks.
MCheu
----------------------------------------------------------------------------------------------
<HTML>
<!---- Test.html --->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
// Makes an element visible
function showElement(element)
{
//element.style.display='';
element.style.display='block';
}
// Makes an element disappear
function hideElement (element)
{
element.style.display='none';
}
-->
</SCRIPT>
</HEAD>
<BODY>
<A HREF="#nowhere" onclick="showElement(id1);">Show</A>
<BR>
<A HREF="#nowhere" onclick="hideElement(id1);">Hide</A>
<BR><BR>
--------------------------------------<BR>
<DIV ID="id1" style="display:none">
CAN YOU SEE ME?
</DIV>
--------------------------------------<BR>
</HTML>
I'm trying to figure out how to hide text in a DIV block and then hide
and unhide it using javascript. In the code that follows, the message
is initially invisible, and when you click on the "show" link, it's
made visible and pops up bettween the two hyphen lines. When you
click on the "hide" link, it's made invisible again. Or at least
that's what is supposed to happen.
It does all of this just fine in IE5, IE5.5, and IE6. However, in
Mozilla 1.5, the display attribute doesn't get changed, and the
message text remains hidden.
A google search of past postings mentions that this doesn't work in
Netscape 4, but it *is* supposed to work in Netscape 6, which I guess
is approximately equivalent to Mozilla 1.0.
Is there something different I need to do to get this to work in the
Netscape/Mozilla family of browsers?
Thanks.
MCheu
----------------------------------------------------------------------------------------------
<HTML>
<!---- Test.html --->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
// Makes an element visible
function showElement(element)
{
//element.style.display='';
element.style.display='block';
}
// Makes an element disappear
function hideElement (element)
{
element.style.display='none';
}
-->
</SCRIPT>
</HEAD>
<BODY>
<A HREF="#nowhere" onclick="showElement(id1);">Show</A>
<BR>
<A HREF="#nowhere" onclick="hideElement(id1);">Hide</A>
<BR><BR>
--------------------------------------<BR>
<DIV ID="id1" style="display:none">
CAN YOU SEE ME?
</DIV>
--------------------------------------<BR>
</HTML>