CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 19th, 2003, 04:51 AM
belena belena is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: London
Posts: 2 belena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to comply with all...css help needed

Hi All,

I have a problem to solve.

I have a table whose rows can be either in edit or view mode. For that I need to toggle the visibility and the display of both of them. I had all of this working in MSIE 5.5...but I thought it would be a lot better if I could make it work in Opera. And I made it work...it took some code refining, adjusting firmly to w3 standards but...I end up with a solution that was working in Opera 7 but not working in IE 5.5. And from what I have seen in forums, the solotion for Opera 7 its not supported by MSIE...

This is a mockup of my code in Opera:
<table>
<tr style="visibility: visible; display: table-row">
<td> Some data</td>
</tr>
</table>

whereas in MSIE I would use display: inline...

I inmediately thought of browser sniffing...but that means keeping two sets of code for the javascript file ...and then I have to take care too of the embedded styles in the html pages. This puts me off a bit. I would also like to achieve the ideal of one code works for both...

I have been playing with the idea of not using a table and using divs instead of rows...but I would like to keep it in that way...
Has anyone got any idea of how can I do it keep the rows, and make it work both in Opera and MSIE? That would be very useful? Has anyone solved this problem before?

Thanks in advance for your help!

Belen

Reply With Quote
  #2  
Old August 19th, 2003, 05:54 AM
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 21 h 56 m 52 sec
Reputation Power: 14
How about this. It uses the behavior that IE will throw an error when trying to set the display property to 'table-row'. The script instead sets the property to 'inline' in case an error would have been reported... It works in IE5.5, Opera7 and Mozilla.
Code:
function showHideRow(id) {
	var myElem = document.getElementById(id)
	if (myElem.style.display == 'none') {
		try {
			myElem.style.display = 'table-row'
		}
		catch(e) {
			myElem.style.display = 'inline'
		}
	}
	else {
		myElem.style.display = 'none'
	}
}
</script>
</head>
<body>
<div onclick="showHideRow('mytablerow')">show/hide</div>
<table>
<tr id="mytablerow">
<td> Some data</td>
</tr>
</table> 


Hope this helps,
Jeroen

Reply With Quote
  #3  
Old August 19th, 2003, 09:49 AM
belena belena is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: London
Posts: 2 belena User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks a lot for your help! I'll try right now.

Reply With Quote
  #4  
Old August 19th, 2003, 12:12 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: 10
Devshed just had an article on error catching but, correct me if i'm wrong, it only works with IE6 and NS6+. Thus it might not work on IE5.5, like you have. Hope that helps.

http://www.devshed.com/Client_Side/...tion/page1.html <-- link to the article

--Neil

Reply With Quote
  #5  
Old August 19th, 2003, 05:07 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 21 h 56 m 52 sec
Reputation Power: 14
The script I proposed works in IE5.5, Opera7 and Mozilla. (I tested it on my machines...)

According to Microsoft: "In Internet Explorer 5 and later, you can use the try...catch...finally statement to implement error handling in JScript." [http://support.microsoft.com/defaul...kb;en-us;183616]

Jeroen

Reply With Quote
  #6  
Old August 19th, 2003, 05:29 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: 10
Oh ok, thats good... might wanna tell the Devshed writer that then

--Neil

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > How to comply with all...css help needed

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap