javascript ---单击将内容复制到剪贴板 [英] javascript---click copy the content to the clipboard

查看:81
本文介绍了javascript ---单击将内容复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是代码。但它不起作用。它出什么问题了?谢谢。

the following is the code. but it doesn't work. what's wrong with it? thank you.

      <head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>no title</title>
   <script type="text/javascript">
      function copyToClipBoard(content){
 var clipBoardContent = ''; 
clipBoardContent = content;
 window.clipboardData.setData("Text",clipBoardContent);
 alert('have copied to the clipboard');
}


 <body>
<textarea rows="4" cols="60" id="url">www.example.com</textarea>
     <input type="button" value="click me" onclick="copyToClibBoard (document.getElementById   ('url').value);" />

</body>


推荐答案

你不能在Javascript中这样做。

You cannot do this in Javascript.

相反,您需要使用Flash

这篇关于javascript ---单击将内容复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆