简体   繁体   English

单击时复制链接文本吗?

[英]Copying link text as you click on it?

I have a website with various links on it. 我有一个网站,上面有各种链接。 I would like to know if it is possible to code the links in a fashion where once a user clicks on the link, the link text is copied to the user's clipboard while the opening of the link is initiated. 我想知道是否有可能以一种方式对链接进行编码,即一旦用户单击链接,就会在启动链接打开时将链接文本复制到用户剪贴板。

Thanks in advance! 提前致谢!

http://zeroclipboard.org/ http://zeroclipboard.org/

You can use Zero Clipboard to do the copying and set the onclick handler of the link. 您可以使用零剪贴板进行复制并设置链接的onclick处理程序。

<a onclick="copyMyText(this)" href="url">Text here</a>

This is possible but only reliable if you use flash which is a big downfall, there are libraries like zero clipboard that are good for this, but other than that its quite a tedious job. 这是可能的,但只有在使用Flash的情况下才是可靠的,Flash的下降幅度很大,像零剪贴板这样的库对此很有用,但除此之外,这是一件非常繁琐的工作。 This cant be done cross browser with javascript 无法使用JavaScript在跨浏览器中完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM