David Golightly escreveu:
> visu wrote:
>> Wondering if anyone can tell me if it's possible to have Javascript
>> select the contents of a div tag with a unique id by clicking
>> somewhere in the contents of that div tag?
It's not very reliable what I've wrote, but take a look:
function select(o){
if(window.getSelection && document.createRange){
var s = window.getSelection(), r = document.createRange();
r.selectNode(o), s.removeAllRanges(), s.addRange(r);
}
else if(o.createTextRange)
o.createTextRange().select();
}
select(document.body);
> Alternativley, you might want to just give users a textarea they can
> dump text into.
As a user I preffer to choose what I'll copy and paste, but if the job
is a kind of routine, then I think you should copy the html/text of the
element instead of selecting it visually.
--
Jonas Raoni Soares Silva
http://www.jsfromhell.com