CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 15th, 2003, 05:08 PM
Jason Keeler Jason Keeler is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 33 Jason Keeler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 56 sec
Reputation Power: 8
Question JS/CSS hide - OK is MSIE & OP, not in NS

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.

Reply With Quote
  #2  
Old August 15th, 2003, 05:21 PM
Clone53421's Avatar
Clone53421 Clone53421 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2003
Posts: 689 Clone53421 User rank is Private First Class (20 - 50 Reputation Level)Clone53421 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 7 m 56 sec
Reputation Power: 6
Send a message via AIM to Clone53421
el.style.visibility = "hidden" should work in IE or NN.

Reply With Quote
  #3  
Old August 15th, 2003, 05:24 PM
knew youzr knew youzr is offline
The New User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: CA, USA
Posts: 109 knew youzr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #4  
Old August 15th, 2003, 05:33 PM
jerom jerom is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Posts: 1,014 jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level)jerom User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 17 h 34 m 25 sec
Reputation Power: 9
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

Reply With Quote
  #5  
Old August 15th, 2003, 07:35 PM
Jason Keeler Jason Keeler is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 33 Jason Keeler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 56 sec
Reputation Power: 8
Quote:
Originally posted by knew youzr
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



I've got NS 7.02. And I just double checked it - the script works OK on it.

Reply With Quote
  #6  
Old August 15th, 2003, 07:37 PM
Jason Keeler Jason Keeler is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 33 Jason Keeler User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 56 sec
Reputation Power: 8
Quote:
Originally posted by jerom
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



Thanks Jeroen, that works a treat - I haven't tried it in NS 4 yet.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > JS/CSS hide - OK is MSIE & OP, not in NS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway