SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can not add style to an innerHtml <tr>

    Hello. I am trying to style a <tr> that is generated using innerhtml. I have tried giving it a class, an id, and styling it inline. Not sure what the deal is. If i try it with the <td> it works fine. Any help would be appreciated. Thanks in advance.

    var txt = document.getElementById("tbod1");

    while (resultSet.isValidRow())
    {
    txt.innerHTML+='<tr>';

    for (var i = 0; i < resultSet.fieldCount(); i++)

    txt.innerHTML+='<td>' + resultSet.field(i) + '</td>';

    resultSet.next();

    txt.innerHTML+='</tr>';
    }

  2. #2
    SitePoint Addict bronze trophy AllanP's Avatar
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    298
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You may need to increase the weight of the style being applied to allow it to work. You can do this by using more selectors and element names to refer to the target. Try this rule in your CSS:
    table#your_id tr.your_class { your styles; }

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks alot for the reply! I figured it out though. Should have posted sooner. Thanks again.


Tags for this Thread

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
  •