Please help me to solve this one. I have page with tables (including hidden tables), my problem is how can I copy both the content of the table.
Here is my code snippets:
Expand|Select|Wrap|Line Numbers
- function copyTable(tableNumber) {
- // Get the table frame
- var tableIFrame = eval("generatedFrame" + tableNumber);
- // Get the table
- var tableOnPage = tableIFrame.document.getElementById("table" +
- tableNumber);
- // Clone this table, so that we can remove the links without changing
- the page
- var myTable = tableOnPage.cloneNode(true);
- var hiddenTableOnPage = document.getElementById
- ("tableIDHiddenField" + tableNumber);
- var myHiddenTable = hiddenTableOnPage.cloneNode(true);
- var myTableHTML = "";
- // Run through stripping out links
- for (var i=0;i < myTable.document.all.length; i++) {
- if (myTable.document.all(i).tagName == 'A') {
- myTable.document.all(i).removeNode(false);
- }
- }
- // Get the HTML for the table
- for (var i=0;i < myTable.document.all.length; i++) {
- if (myTable.document.all(i).tagName == 'TH' ||
- myTable.document.all(i).tagName == 'TD') {
- myTableHTML += myTable.document.all
- (i).innerText + '\t';
- }
- if (myTable.document.all(i).tagName == 'TR') {
- if (myTableHTML.length > 1)
- myTableHTML += '\n';
- }
- }
- // Run through stripping out links
- for (var i=0;i < myHiddenTable.document.all.length; i++) {
- if (myHiddenTable.document.all(i).tagName == 'A') {
- myHiddenTable.document.all(i).removeNode(false);
- }
- }
- // Get the HTML for the hidden table
- for (var i=0;i < myHiddenTable.document.all.length; i++) {
- if (myHiddenTable.document.all(i).tagName == 'TH' ||
- myHiddenTable.document.all(i).tagName == 'TD') {
- myTableHTML += myHiddenTable.document.all
- (i).innerText + '\t';
- }
- if (myHiddenTable.document.all(i).tagName == 'TR') {
- if (myTableHTML.length > 1)
- myTableHTML += '\n';
- }
- }
- // Put the HTML into the clipboard.
- window.clipboardData.setData('Text', myTableHTML);
- }
I want to copy the content of this both table. Ho can i do that?
Please help me out this...I will greatly appreciate ur help..
Regards,
froi