Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2003
    Location
    NJ - #29 if you must know
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing the text within a table cell?

    for instance:

    <table id="test" width=100% border=0>
    <tr>
    <td>col1</td><td>col2</td>
    </tr>
    </table>

    OK.

    So with the above the word "col1" is in column 1
    and "col2" is in column 2.

    Is there anyway using JS to replace the word col1
    to something else?

    Thanks

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    <table id="test" width=100% border=0>
    <tr>
    <td id="cell1">col1</td><td>col2</td>
    </tr>
    </table>
    
    document.getElementById('cell1').innerHTML = 'Whatever you want in the table cell.';

  • #3
    Regular Coder
    Join Date
    Jul 2003
    Location
    NJ - #29 if you must know
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks.

    I didn't want to ID the spots I want to change.....
    but that's probably the easiest and cleanest way.

    George


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •