Computing.Net > Forums > Web Development > Table rows with ID

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Table rows with ID

Reply to Message Icon

Original Message
Name: Michael J (by mjdamato)
Date: June 19, 2005 at 17:18:01 Pacific
Subject: Table rows with ID
OS: XP Pro
CPU/Ram: 2.4GHz P4 / 1GB DDR
Comment:

I have some content within a table and there are several rows which I want to show/hide dynamically using DHTML. I have it working now, but it is not displayed correctly in FireFox.

Currently I am giving certain rows an id value such as: <td id=xyz> ~ usual td's and content ~ </td>. Then using a trigger with some JavaScript code I change the CSS display property of the rows using the getElementById method. However, in FireFox, it appears to interpret the TR's with an ID as new tables instead of TR's within the current table.

So, I am looking for a solution that is cross-browser compatible. Any ideas? BTW: I am using the table to control the horizontal position of the content. I am also considering using the innerHTML method to rewrite the entire table.

To see the table, go to http://repeat-offenders.org/index.php. The table is the TeamSpeak block on the right-hand side of the page. If you 'expand' one of the channels by clicking the plus sign, you will see the problem (if you are using FireFox).


Report Offensive Message For Removal


Response Number 1
Name: Smittymator
Date: June 19, 2005 at 21:00:32 Pacific
Reply: (edit)

Hey,

This may help you, or it may not, but I noticed when I was building my site that tables in firefox behave better if you either define their size by pixels rather than percent, or just don't specify a size at all for the width, that way the table width should show itself according to the width of the largest single object or unspaced row of text, especially when changing resolutions.

Just a thought

If that isn't helpful, let me know, I'll gladly help you find the solution to your problem. I can be reached through my website, either sign up for the forum or just email me.

Btw, I like the design you chose for your site. Looks good:)

-Smitty

Need a solution to a computer-related problem? Visit my site and get the help you need, quickly. You can join our forum, browse through the tutorials, or ask a question directly via email!


Report Offensive Follow Up For Removal

Response Number 2
Name: Michael J (by mjdamato)
Date: June 20, 2005 at 07:21:20 Pacific
Reply: (edit)

Smitty, thanks for the response, but that is not related to my problem. My problem has to do with the way IE and FireFox interpret the rows with ID's when I am changing the display property. The tables are fine if I remove the code to dynamically hide/show the rows.

But, I think I may have found the solution...

Currently I am changing the CSS display property from 'none' to 'inline' of selected TR elements to hide/show the selected rows. And, this works in IE, but possibly because IE is handling it incorrectly.

According to this page (http://www.w3schools.com/css/pr_class_display.asp), the inline attribute will display the content without line-breaks. It appears FireFox is interpreting the table rows with this property as being an element within the current row/cell.

Also on that page, there is a reference to a 'table-row' value for the display property. This would appear to be the value I should be using (of course, with my luck it is not supported in IE!). I will try that and see if it works.

Michael J


Report Offensive Follow Up For Removal

Response Number 3
Name: Michael J (by mjdamato)
Date: June 21, 2005 at 06:22:25 Pacific
Reply: (edit)

As I predicted, the table-row value works in FireFox but not IE. I can create a swich based upon wether the browser is IE of FireFox, but what of other browsers. For my purposes it is not critical, but I'd like a better solution. I guess I will need to redesign the content to fin a cross-browser solution.

Michael J


Report Offensive Follow Up For Removal

Response Number 4
Name: FBI Agent
Date: June 21, 2005 at 07:13:50 Pacific
Reply: (edit)

i'd use javascript.

if you click on the plus sign, it writes a table row under the plus (or something) and if you click on the minus sign, it takes that code away.

if i knew the syntax for javascript i would write an easy code for you, but i dont know javascript, i just know how it works and what you can do with it.

FBI Agent

AIM: EliteAssassin187


Report Offensive Follow Up For Removal

Response Number 5
Name: Michael J (by mjdamato)
Date: June 21, 2005 at 22:05:14 Pacific
Reply: (edit)

I am using JavaScript. But to use it to write/remove code would be problematic in keeping track of the code. At this point I'm considering converting all of the table data to an array and dynamically rewriting the table on each click.

Thanks


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home








Do you own an iPhone?

Yes
No, but soon
No


View Results

Poll Finishes In 7 Days.
Discuss in The Lounge
Poll History




Data Recovery Software