Web Analytics Made Easy -
StatCounter DOM firefox - CodingForum

Announcement

Collapse
No announcement yet.

DOM firefox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DOM firefox

    In the following example IE alert to me the innerHTML of the 1st table row as I expected it would, but Firefox states that row has no properties, any idea what I am doing wrong? note both browser auto inserts a Tbody element in the table

    Code:
    </html>
    <head>
    </head>
    <body>
    	<table id="_2ndGrid">
    	  <tr>
    		  <th>Column1
      		</th>
    		  <th>Column2
      		</th>
    		  <th>Column3
      		</th>
    		</tr>	
    	  <tr>
    		  <td>1
      		</td>
    		  <td>b
      		</td>
    		  <td>00a
      		</td>
    		</tr>
    		<tr>
    		  <td>2
      		</td>
    		  <td>a
      		</td>
    		  <td>00b
      		</td>
    		</tr>
    	</table>
    	<script>
    	  table=document.getElementById("_2ndGrid");
    		var row=table.firstChild.firstChild;
    		alert(row.innerHTML);
    	</script>
    </body>
    </html>

  • #2
    Gecko adds spaces and new lines as empty text nodes into the document tree. IE does not. For the same result clear all emty text nodes which are children of <table> before accessing table elements:
    http://www.codingforum.net/showthrea...&threadid=7028

    Also as far as I remember you get different presentation of table node in IE and Gecko when you omit <tbody> tag. I think Gecko adds it automatically, while IE does not.... I think....
    http://www.vladdy.net/webdesign/DOM_TreeViewer.html - may help
    Last edited by Vladdy; Feb 26, 2004, 12:55 PM.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

    Comment


    • #3
      Well it migth be the rigth way to do according to some geek standard writers,but in my opinion it was just plain stupid.

      anyway I solved the stupidity by writing the TBody element myself.

      and IE do put a TBody element by it self also.

      Comment


      • #4
        <note nature="phylosophical">
        Things you do not understand are not necesserily stupid
        </note>
        Vladdy | KL
        "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

        Comment

        Working...
        X