...

View Full Version : take an object from one page and put it in a new page



zephyros
03-23-2004, 02:00 AM
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.

nolachrymose
03-23-2004, 02:12 PM
Yes. Have a basic page designed that you'll open with window.open(). Assuming table two has the ID "table2" this should work:


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! :)

zephyros
03-23-2004, 05:23 PM
Cool! Thanks very much!

Kor
04-06-2004, 01:24 PM
You may either use nonstandard innerHTML method



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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum