DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2005
    Posts
    3

    what's the deal with span tag and tables tags?

    Does anyone know what is the way IE treats span tags(<span>) and table tags(<tr>, <td>)? Should the <span> tag be encolsed in tds and trs if it placed with other elements that are in a table? Can the span tag itself contain table tags within it?

    I have some scripting code and when I wrap the span in table elements it does not find the html within the span. Here is an example....


    <tr><td colspan="4" align="left"><span id="201294_38604_1">[some html here including tds and trs]</span></td></tr>

    var span = document.getElementById(spanId);
    alert("the value inside span is " + span.innerHTML); // this is blank

    And if I do not wrap the span in table tags like so....

    <span id="201294_38604_1">[some html here including tds and trs]</span>

    It finds the html in the span. But when I clear the contents of the html and later try to put some other html in, I do not see the html on the screen.

    Any help would be appericated.

  2. #2
    Join Date
    Aug 2004
    Posts
    64
    What you speak of is invalid HTML in all browsers, not just IE. A td can only be nested inside a tr, and a tr can only be nested inside a table (or thead, tbody, tfoot, which must be then inside a table). You cannot directly put any elements other than table elements inside a table. Other elements can only go inside table cells (td). Whatever you are trying to accomplish can most certainly work with proper HTML.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links