admin管理员组文章数量:1345324
I am building a web page and have run into something that would be nice to be able to do; set text to be copied to the clipboard when someone tries to copy an image, probably the same as the alt text. Is there any way with javascript/html that this can be done? If so, please explain.
Thanks for any help!
Edit: Basically, I want to let my users highlight the image, press control-c, and then have the alt text stored in their clipboard.
I am building a web page and have run into something that would be nice to be able to do; set text to be copied to the clipboard when someone tries to copy an image, probably the same as the alt text. Is there any way with javascript/html that this can be done? If so, please explain.
Thanks for any help!
Edit: Basically, I want to let my users highlight the image, press control-c, and then have the alt text stored in their clipboard.
Share Improve this question edited Jul 28, 2012 at 3:00 asked Jul 28, 2012 at 2:54 user1559041user1559041 6- Are you looking to just copy the alt text? Or HTML that contains the image and some sort of caption with it? – Brad Commented Jul 28, 2012 at 2:56
- Just to copy the alt text when someone highlights the image and copies it would be great. – user1559041 Commented Jul 28, 2012 at 2:58
- Normally no images get copied on pressing cttl + c when hovered on a image. So what you means by highlighted? – McLosys Creative Commented Jul 28, 2012 at 3:20
-
I think only IE supports
oncopy
for images and you'd probably need flash for the copying to clipboard part – Musa Commented Jul 28, 2012 at 3:25 - @McLosysCreative Hightlight as in clicking down and dragging over it, the way you would copy text. – user1559041 Commented Jul 28, 2012 at 12:26
4 Answers
Reset to default 5add attribute alt="text"
to your image
example:
<img alt="
本文标签:
javascriptHow can I set text to be copied to clipboard when image is copiedStack Overflow
版权声明:本文标题:javascript - How can I set text to be copied to clipboard when image is copied? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人,
转载请联系作者并注明出处:http://www.betaflare.com/web/1743759397a2534092.html,
本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论