Reputation: 601
I have this function which selects all text in an element (table in this case)
function SelectText(element) {
var text = document.getElementById(element);
var range = document.body.createTextRange();
range.moveToElementText(text);
range.select();
}
I need help making it do the following
Upvotes: 0
Views: 62
Reputation: 2201
range.execCommand("Copy");
That will put your text in the clipboard.
I don't think ignoring words is possible. You could potentially remove the text before copying.
Upvotes: 1
Reputation: 324587
That code is IE only, and IE doesn't support multiple selections. The only major browser that does is Firefox, so you may want to abandon that idea. Also, it's not generally possible to copy content to the clipboard with JavaScript, although there are Flash-based hacks like Zeroclipboard (http://code.google.com/p/zeroclipboard) that do this.
Upvotes: 2