Beautiful!!
Thanks Joe
-----Original Message-----
From: Joe Fawcett [mailto:joefawcett@h...]
Sent: 04 July 2002 16:37
To: javascript
Subject: [javascript] Re: copy to clipboard - More
Further tests reveal you are right, if the table row has more than one cell
then the findText fails and the range is not modified as per the docs. I
would suggest a differnent approach:
clipboardData.setData("text", oRow.innerText);
Joe
>From: "Alex Shiell, ITS, EB, SE" <alex.shiell@s...>
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] copy to clipboard
>Date: Thu, 4 Jul 2002 15:40:15 +0100
>
>I would like to copy the selected row of a table to the clipboard.
>
>As far as my understanding goes, this code should do it:
>
>var r = document.body.createTextRange();
>r.findText(oRow.innerText);
>r.select();
>r.execCommand("copy");
>
>But it always selects and copies the entire page.
>
>(if I alert oRow.innerText it does show me the text I want to copy)
>
>Does anyone know what I'm doing wrong?
>
>________________________________________________________________________
>Scottish Enterprise Network
>http://www.scottish-enterprise.com
>
>Headquarters Address & Contact Numbers
>
>150 Broomielaw
>5 Atlantic Quay
>Glasgow
>G2 8LU.
>Tel: +44 (0) 141 248 2700.
>Fax: +44 (0)141 221 3217
>
> This message is sent in confidence for the addressee only.
>It may contain legally privileged information. The contents are not to
>be disclosed to anyone other than the addressee. Unauthorised recipients
>are requested to preserve this confidentiality and to advise the sender
>immediately of any error in transmission.
>
>
>
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20
_________________________________________________________________
Join the world's largest e-mail service with MSN Hotmail.
http://www.hotmail.com
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
________________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com
Headquarters Address & Contact Numbers
150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel: +44 (0) 141 248 2700.
Fax: +44 (0)141 221 3217
This message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.