Hey! Just found this forum, so I thought I’d give it a shot…
So…I have a page that has 3 or 4 bits of text stored in div’s, and each has a button associated with it. If you push that button, you can (IE users) copy that text to the clipboard via this method:
function copyExport(type)
{
window.clipboardData.setData(“Text”, document.getElementById(‘export_’+type).innerText);
}
where, of course, export_(type) is where the text is.
Now…using IE 6.02, suppose I have 4 pieces of data, and 4 buttons. If I click on each one of those, the data is successfully copied to the clipboard.
However, I’d like to add a fifth button that will copy all that data to the clipboard in successive bursts
Something to the extent of
onClick=”copyExport(‘a’); copyExport(‘b’); copyExport(‘c’); copyExport(‘d’);”
[note: the data can’t all be sent at once; it must be copied in individual pieces]
The problem is that it never seems to ‘copy’ all 4 pieces. Only one or two random ones seem to appear in the clipboard at any point.
I tried sticking an alert() in the method so there was a pause between each copy command, and that seemed to do the trick, but of course I’d rather not have the user subjected to that. I tried using setTimeout to put a 100ms delay in between each copy command, but that didn’t seem to work.
Any ideas as to why this is happening, and how to fix it?
Thanks in advance.