Copy text

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Jim_Bo
Forum Contributor
Posts: 390
Joined: Sat Oct 02, 2004 3:04 pm

Copy text

Post by Jim_Bo »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

Any ideas how to het the following to work within firefox with same functionality (text doesnt have to be highlighted)

[syntax="javascript"]<script language="JavaScript">
function ClipBoard()
{
holdtext.innerText = copytxt.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
}
</SCRIPT>

<textarea name="copytxt"><a href="#">Link</a></textarea><button onClick="ClipBoard();">Copy to Clipboard</button><br />
<textarea ID="holdtext" STYLE="display:none;">
</textarea>
Thanks


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

That feature is disabled by default in Firefox.

Google has a TON to offer on the subject: firefox javascript clipboard
Post Reply