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
    New Coder
    Join Date
    Aug 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Can tables be positioned on the fly?

    Ok, this is probably a really stupid question, but... Is there a way to have a table inserted multiple times in a webpage ON THE FLY (that is, as the webpage is loaded)? For instance, suppose we have a table like this, and a body of code which FOLLOWS it:

    <table id="blah"> {a bunch of text and other stuff} </table>

    <body>
    content
    content
    content
    {insert first instance of table "blah"}
    content
    content
    content
    {insert second instance of table "blah"}
    content
    content
    {insert third instance of table "blah"}
    etc. etc.
    </body>



  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    You can't clone it with HTML alone.

    Either you'll need to use a server side language like php:

    <body>
    content
    content
    <?php echo "$tablestuff";?>
    content
    content
    <?php echo "$tablestuff";?>
    content
    content
    <?php echo "$tablestuff";?>
    </body>

    Or use DOM1 cloneNode(true), and appendChild() on page load, but that is IE5+/NS6+-only for now.

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, jkd. Are these then the only two solutions if I just want to insert ONE instance of the table (I'm trying to try to make this compatible with pre-IE5+/NS6)? In other words, other than using relative positioning (which would render a blank space where the table was coded within the source code), is there any way to have a table rendered in a different place than were it was coded within the source code? For instance:

    Say, the source code would have THIS order:

    <body>
    <table id="blah"> {a bunch of text and other stuff} </table>
    content
    content
    content
    content
    content
    content
    </body>


    But then the webpage would look like this:

    <body>
    content
    content
    content
    <table id="blah"> {a bunch of text and other stuff} </table>
    content
    content
    content
    </body>




  •  

    Posting Permissions

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