How to Copy to Clipboard in JavaScript and make it HTML?

谁说我不能喝 提交于 2019-12-11 08:52:49

问题


I found some nice solutions here on how to copy text in JavaScript to the clipboard in: How do I copy to the clipboard in JavaScript?

But is there any way to give it a type? Want I want is to paste to clipboard something like:

this is < b >bold< /b >

and when pasting it into OpenOffice or Word, get

this is bold


回答1:


You could just manipulate the string the user selects before sending it to the clipboard. Refer the answer for this question which shows how a string manipulation could be done before copying it to the clipboard.



来源:https://stackoverflow.com/questions/5067894/how-to-copy-to-clipboard-in-javascript-and-make-it-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!