/    Sign up×
Community /Pin to ProfileBookmark

</tr> in a cell – Browser incompatability.

Hi,

I am a newbie to HTML.
I need to display a table in a web page.
Each row of a HTML table is a row in a SNMP table.
The index to the SNMP table is incremented by the </tr> tag

I have a requirement to display 2 SNMP rows as 1 HTML row.
My HTML code looks like

<tr id=”row3″>
<td id=”t.6″ style=’font-family:”courier New”; font-size:15px; font-weight:bold;’>$$INDEX0$$</td>
<td id=”t.7″>$$REFID9900$$</td>
<td id=”t.8″>$$REFID9901$$</td>
<td style=”display:none”> </tr> </td>
<td id=”t.9″>$$REFID9900$$</td>
<td id=”t.10″>$$REFID9901$$</td>
</tr>
<tr id=”row4″>
<td id=”t.11″ style=’font-family:”courier New”; font-size:15px; font-weight:bold;’>$$INDEX0$$</td>
<td id=”t.12″>$$REFID9900$$</td>
<td id=”t.13″>$$REFID9901$$</td>
<td style=”display:none”> </tr> </td>
<td id=”t.14″>$$REFID9900$$</td>
<td id=”t.15″>$$REFID9901$$</td>
</tr>
<tr id=”row5″>
<td id=”t.16″ style=’font-family:”courier New”; font-size:15px; font-weight:bold;’>$$INDEX0$$</td>
<td id=”t.17″>$$REFID9900$$</td>
<td id=”t.18″>$$REFID9901$$</td>
<td style=”display:none”> </tr> </td>
<td id=”t.19″>$$REFID9900$$</td>
<td id=”t.20″>$$REFID9901$$</td>
</tr>
<tr id=”row6″>
<td id=”t.21″ style=’font-family:”courier New”; font-size:15px; font-weight:bold;’>$$INDEX0$$</td>
<td id=”t.22″>$$REFID9900$$</td>
<td id=”t.23″>$$REFID9901$$</td>
<td style=”display:none”> </tr> </td>
<td id=”t.24″>$$REFID9900$$</td>
<td id=”t.25″>$$REFID9901$$</td>
</tr>

Please note that I have added the following line, only to increment the SNMP index.
<td style=”display:none”> </tr> </td>

With the above code, the page is displayed as I expected, in IE 8. Each row is displayed as follows.

$$INDEX0$$ $$REFID9900$$ $$REFID9901$$ $$REFID9900$$ $$REFID9901$$

But, in Firefox and Chrome the row is displayed as follows.

$$INDEX0$$ $$REFID9900$$ $$REFID9901$$
$$REFID9900$$ $$REFID9901$$

I think there is browser incompatability coming in to play here.

Any help to overcome this problem and make the code browser independant is highly appreciated.

Thanks.

to post a comment
HTML

9 Comments(s)

Copy linkTweet thisAlerts:
@svidgenMar 19.2012 — I don't fully understand your requirement, but this is simply invalid markup:

[code=html]<tr id="row3">
<td id="t.6" style='font-family:"courier New"; font-size:15px; font-weight:bold;'>$$INDEX0$$</td>
<td id="t.7">$$REFID9900$$</td>
<td id="t.8">$$REFID9901$$</td>
<td style="display:none"> </tr> </td>
<td id="t.9">$$REFID9900$$</td>
<td id="t.10">$$REFID9901$$</td>
</tr>[/code]


You can't close a TR in the middle of a child TD.

This line doesn't accomplish anything:
[code=html]<td style="display:none"> </tr> </td>[/code]

It's markup. It doesn't increment any counters. If your counter incrementing logic "requires" this line to be printed, you just need to change your logic!
Copy linkTweet thisAlerts:
@html_n3wb13authorMar 19.2012 — Thanks for your quick reply.

I'm sorry, I wasn't clear.

The HTML page is part of a web server residing in a device.

The HTML Parser in the device, in the backend queries the SNMP agent in the device.

The HTML parser whenver it sees the </tr> tag increments the SNMP index.

Do you have any suggestions as to how can I accomplish this.

Thanks.


I don't fully understand your requirement, but this is simply invalid markup:

[code=html]<tr id="row3">
<td id="t.6" style='font-family:"courier New"; font-size:15px; font-weight:bold;'>$$INDEX0$$</td>
<td id="t.7">$$REFID9900$$</td>
<td id="t.8">$$REFID9901$$</td>
<td style="display:none"> </tr> </td>
<td id="t.9">$$REFID9900$$</td>
<td id="t.10">$$REFID9901$$</td>
</tr>[/code]


You can't close a TR in the middle of a child TD.

This line doesn't accomplish anything:
[code=html]<td style="display:none"> </tr> </td>[/code]

It's markup. It doesn't increment any counters. If your counter incrementing logic "requires" this line to be printed, you just need to change your logic![/QUOTE]
Copy linkTweet thisAlerts:
@html_n3wb13authorMar 19.2012 — Is the following a valid markup

<td style="display:none"> <tr> </tr> </td>

Thanks.
Copy linkTweet thisAlerts:
@svidgenMar 19.2012 — Interesting. Well, I'd start by trying one of two things. In this line:
[code=html]<td style="display:none"> </tr> </td>[/code]

Open the TR before you close it:
[code=html]<td style="display:none"> <tr></tr> </td>[/code]

Or try putting a "full" table in the cell:
[code=html]<td style="display:none"> <table><tr><td></td></tr></table> </td>[/code]
Copy linkTweet thisAlerts:
@svidgenMar 19.2012 — Is the following a valid markup

<td style="display:none"> <tr> </tr> </td>

Thanks.[/QUOTE]


I didn't see this post when I responded -- no, it's not. But, I imagine it's more likely to render correctly than the lone closing TR.
Copy linkTweet thisAlerts:
@html_n3wb13authorMar 19.2012 — Thanks again for your quick reply.

I've tried both.

With

<td style="display:none"> <tr></tr> </td>,

there is no change in behavior in Firefox and Chrome.

And, IE 8 is messed up. It is behaving like Firefox.


With

<td style="display:none"> <table><tr><td></td></tr></table> </td>

the display is as expected. But, when HTMLParser sees a <table> tag in a cell the contents of the table are messed up.
Copy linkTweet thisAlerts:
@svidgenMar 19.2012 — Maybe build 2 tables -- a hidden table that serves the HTMLParser and another that displays the information as you'd like it displayed. If the visible table throws the parser off, build it using DIV's and CSS instead.
Copy linkTweet thisAlerts:
@html_n3wb13authorMar 19.2012 — Thanks for your suggestions. I appreciate your help.

I'll try your suggestions.

Do you think </tr> in between <div> & </div> is a valid markup.
Copy linkTweet thisAlerts:
@jedaisoulMar 20.2012 — 
Do you think </tr> in between <div> & </div> is a valid markup.
[/QUOTE]

I doubt it. Surely </tr> should follow <tr> and be inside <table> </table>?

Have you tried using two separate tables positioned side-by-side? Alternatively, will </tr> trigger the row counter, if it is commented out so far as the html is concerned? e.g.

<!-- /tr --> or <!-- </tr> --> or perhaps <!-- /* </tr> */ -->

Just ideas!
×

Success!

Help @html_n3wb13 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...