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 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    take an object from one page and put it in a new page

    Sorry for newbie question:

    I would like to some objects that are on a page and put them into a new window.

    For instance, I have 3 tables on a page, and I want to put table 2 in its own window.

    Is that possible?

    Any ideas or links would be appreciated.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    338
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes. Have a basic page designed that you'll open with window.open(). Assuming table two has the ID "table2" this should work:

    Code:
    function showTable() {
    	var myTable = document.getElementById("table2").cloneNode(true);
    	var x = window.open("template.htm");
    	x.onload = function() {
    		x.document.body.appendChild(myTable);
    	}
    }
    Hope that helps!

    Happy coding!

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile This is great! Thanks!

    Cool! Thanks very much!

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You may either use nonstandard innerHTML method

    PHP Code:
    function showTable() {
        var 
    myTable document.getElementById("table2").innerHTML;
        var 
    window.open("template.htm");
        
    x.onload = function() {
            
    x.document.body.innerHTML myTable;
        }

    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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