Jim...

That's a GREAT idea. Good job.

<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->

-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: Monday, October 17, 2005 7:55 PM
To: CF-Talk
Subject: RE: JS copy function?


> -----Original Message-----
> From: Ray Champagne [mailto:[EMAIL PROTECTED]
> Sent: Monday, October 17, 2005 4:49 PM
> To: CF-Talk
> Subject: SOT: JS copy function?
>
> Is there a way to (behind the scenes) copy text to the user's clipboard
> without them having to select and Ctrl-C it?  I know that the plug-in
> for TinyURL does this, but I'm not sure how, or if I'm comparing A's to
> O's or whatever.

Here's a little script I throw at the bottom of all my pages at
DepressedPress.com.  It provides links to copy the page URL, Title or link
to the clipboard (I use it when doing updates and such).

The code will only work on IE (thus the check for "document.all" before
presenting it).  Shorthand for what you need is:

window.clipboardData.setData("Text", "Whudeva");

I believe that this can also be specifically prevented by a security setting
at well.

<script language="javascript1.3" type="text/javascript">
        function CopyToClip_URL() {
                window.clipboardData.setData("Text",
"http://www.depressedpress.com/index.cfm";);
        };
        function CopyToClip_Title() {
                window.clipboardData.setData("Text", "Welcome to the New
Depressed Press");
        };
        function CopyToClip_Link() {
                window.clipboardData.setData("Text", "<a
href=\'http://www.depressedpress.com/index.cfm\'>Welcome to the New
Depressed Press</a>");
        };
        if ( document.all ) {
                document.write("                <div
class=\"Footer_Disclaimer\">Copy the page <a href=\"JavaScript: var i =
CopyToClip_URL();\">URL</a> or <a href=\"JavaScript: var i =
CopyToClip_Title();\">Title</a> or <a href=\"JavaScript: var i =
CopyToClip_Link();\">Link</a> to the clipboard</div>");
        };
</script>


Hope it helps.

Jim Davis





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221317
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to