无法使用zClip解析剪贴板 - jQuery ZeroClipboard [英] Unable to resolve clipboard using zClip - jQuery ZeroClipboard

查看:68
本文介绍了无法使用zClip解析剪贴板 - jQuery ZeroClipboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个功能将文本复制到剪贴板中。(NOT GETTING MESSAGE AS' text Copied in Cliboard '

I am using this for copying text into clipboard.. (NOT GETTING MESSAGE AS 'text Copied in Cliboard'

http://www.steamdev.com/zclip/

我试过像这样,但我无法将复制的文本到剪贴板中。

I have tried like this, but I am unable to get the copied text into clipboard..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
  <script type="text/javascript" src="js/jquery.zclip.js"></script>

  <script>
    $(document).ready(function() {
      $('textarea#showthis').zclip({
        path: 'js/ZeroClipboard.swf',
        copy: function() {
            return $('#showthis').val();
        }
      });
    });
  </script>
 </head>

 <body>
  <textarea id="showthis" readonly>hi, how are you?</textarea>
 </body>
</html>

请告诉我出了什么问题! (我不知道JavaScript和jQuery的东西!)

Please tell me what went wrong! (I am not aware of JavaScript and jQuery stuff!)

我正在使用Chrome浏览器,并且记得我的电脑上已经安装了Flash。

and I am using Chrome and I remembered correctly Flash already installed on my PC...

编辑:我在尝试:textarea内的文本应该在我点击'TextArea'时立即复制

EDITED: What I am trying for: The text inside textarea should get copied as soon as I click 'TextArea'

推荐答案

您需要一个复制按钮。 Zclip应该附加到用户点击复制文本的按钮 - 而不是textarea本身。

You need a copy button. Zclip should be attached to the button which the user clicks to copy the text - not the textarea itself.

试试这个:

$(document).ready(function(){
    $("#showthisButton").zclip({
        path: "js/ZeroClipboard.swf",
        copy: function () {
            return $('#showthis').val();
        }
    });
});

而HTML应该是这样的:

And the HTML should be this:

<textarea id="showthis">hi, how are you?</textarea>
<input type="button" id="showthisButton" value="Copy">

如果您需要更多帮助,请询问。

If you need any more help, just ask.

这篇关于无法使用zClip解析剪贴板 - jQuery ZeroClipboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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