PDA

View Full Version : Need help in clone html table


bryanpung
06-14-2007, 04:12 AM
I''m using some javascripts for tab content and I would like to copy content from one tab to another tab. I found DOM could achieve this, but I can't get it working in my code.

Can any expert help me on this matter? Very much appreciate for that. Cheers

Please look into attachment for details.

rnd me
06-15-2007, 08:46 AM
this seems a little simpler...

function CopyPrintable(){
var t = document.getElementById('tcontent0').innerHTML;
document.getElementById('print2').innerHTML=t;
alert('Aloha!!!');
}

bryanpung
06-18-2007, 07:30 AM
Many thanks mate. It's working perfectly now. Now the challenging part is how can I copy multiple html element into single element?

Example copy tcontent0, tcontent1 and etc.. into print2 element? Can you please help on this? very appreciate for this. Thanks :)

rnd me
06-21-2007, 09:23 PM
function Group (f, List) {//applies a function to each index of an array
var z = 0;
Ray = [];
len = List.length;
for (z; z < len; z++) {
if (f(List[z])) {
Ray[Ray.length] = f(List[z]);
}
}
return Ray;}

//Example copy tcontent0, tcontent1 and etc.. into print2 element?
var toCopy=[tcontent0, tcontent1];
Group(function(elm){print2.appendChild(elm)}, toCopy );