The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Auto Select and Copy
denmarks
post Jan 17 2008, 05:18 PM
Post #1


Advanced Member
****

Group: Members
Posts: 207
Joined: 17-January 08
Member No.: 4,734



I have a page that is only used by me and is located on my computer. There is an index at the top with descriptions. When a description is clicked the page repositions using <a> tags to a paragraph with the details. The paragraph is surrounded with the <span> tag.

Is there a way to have the text within the paragraph selected and copied when the index item is clicked to get to the paragraph? I always drag through the data and copy. It would be nice to have it automated if possible.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 17 2008, 06:50 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



In IE you can use java script:

CODE
<a href="#a" onclick="window.clipboardData.setData('Text', document.getElementById('a').firstChild.nodeValue);">link</a>
<span id="a">foo</span>


assuming the SPAN contains no markup, just plain text, and assuming your security settings permit reading/writing to your clipboard (not recommended on the www for privacy reasons). Other browsers don't support it.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
denmarks
post Jan 18 2008, 12:04 PM
Post #3


Advanced Member
****

Group: Members
Posts: 207
Joined: 17-January 08
Member No.: 4,734



QUOTE(Christian J @ Jan 17 2008, 06:50 PM) *

In IE you can use java script:

CODE
<a href="#a" onclick="window.clipboardData.setData('Text', document.getElementById('a').firstChild.nodeValue);">link</a>
<span id="a">foo</span>


assuming the SPAN contains no markup, just plain text, and assuming your security settings permit reading/writing to your clipboard (not recommended on the www for privacy reasons). Other browsers don't support it.


Thank you but I need it for Firefox. Any other possibilities?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 18 2008, 08:02 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



Googling turns up some ideas (that I haven't tested), but they seem to require changes to Firefox: http://www.mozilla.org/projects/security/c...ed-scripts.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 09:28 AM