|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The following works in MSIE and Opera, but doesn't in Nescape. How can I adapt it so that it works with all of these browsers?
<html> <head> <style type="text/css"> <!-- #test {display: block;} --> </style> <script language="JavaScript" type="text/JavaScript"> <!-- function doIt(theID) { var el = document.getElementById(theID); el.style.display="none"; } //--> </script> </head> <body onResize="doIt('test');"> <DIV id="test">Hide me!</DIV> </body> </html> Last edited by Jason Keeler : August 15th, 2003 at 05:11 PM. |
|
#2
|
||||
|
||||
|
el.style.visibility = "hidden" should work in IE or NN.
|
|
#3
|
|||
|
|||
|
That script does work in my NS 7.0, which version do you have? If it is NS 4.x, it might be the onResize handler, I do not think that is supported in NS 4.x
--Neil |
|
#4
|
|||
|
|||
|
Mozilla shows and hides the element without any problem (as expected). And I assume NS6+ does too.
If you referred to Netscape 4: onresize is supported, but document.getElementById() is not and neither is the el.style.x syntax. I think this is as close as you can get: Code:
<script language="JavaScript" type="text/JavaScript">
<!--
function doIt(theID) {
if (document.getElementById) {
var el = document.getElementById(theID)
el.style.display = "none"
}
else if (document.layers) {
var el = document.layers[theID]
el.visibility = "hidden"
}
}
//-->
</script>
</head>
<body onresize="doIt('test');">
<div id="test" style="position: relative">Hide me!</div>
Hope this helps, Jeroen |
|
#5
|
|||
|
|||
|
Quote:
I've got NS 7.02. And I just double checked it - the script works OK on it. |
|
#6
|
|||
|
|||
|
Quote:
Thanks Jeroen, that works a treat - I haven't tried it in NS 4 yet. |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > JS/CSS hide - OK is MSIE & OP, not in NS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|