Javascript, HTML Elements, Parsing

Y

Yin99

in my html I have a table I would like to "slice out" and then open
new browser and write to a clean document window. Is there an easy
way to do this in Javascript? The item I would like to slice outhas
an id "GanttTable" and class "ms-ganttInnerTable". Be nice if
Javascript could just grab this element based on this id or class,
store to string and let me write somewhere else.

<table cellPadding="0" cellSpacing="0" id="GanttTable" class="ms-
ganttInnerTable" >

Thanks,
Yin
 
T

Thomas 'PointedEars' Lahn

Yin99 said:
in my html I have a table I would like to "slice out" and then open
new browser and write to a clean document window. Is there an easy
way to do this in Javascript? The item I would like to slice outhas
an id "GanttTable" and class "ms-ganttInnerTable". Be nice if
Javascript could just grab this element based on this id or class,
store to string and let me write somewhere else.

RTFM, STFW.

Serialization to a string should only be used if the DOM does not support
cloneNode().

var slice = document.getElementById("GanttTable");
if (isMethod(slice, "cloneNode"))
{
var sliceClone = slice.cloneNode(true);
if (sliceClone)
{
// ...
parentElementNode.appendChild(sliceClone);
}
}


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,814
Members
47,359
Latest member
Claim Bitcoin Earnings. $

Latest Threads

Top