ZeroClipboard拷贝在ASP.NET MVC到剪贴板 [英] ZeroClipboard for copy to clipboard in ASP.NET MVC

查看:229
本文介绍了ZeroClipboard拷贝在ASP.NET MVC到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要复制到剪贴板功能添加到我的 ASP.NET 网页。我发现 ZeroClipboard ,但我无法找到任何一个例子wroking。我可以把它在本地计算机上工作,或者我需要上传到服务器以测试它?

I want to add a copy-to-clipboard functionality to my ASP.NET webpage. I found ZeroClipboard, but I couldn't find any single example wroking. Can I make it work on local computer or do I need to upload to server to test it?

请给我一个例子链接。

推荐答案

jQuery的ZeroClipBoard 大概会你在找什么。 ZeroClipBoard使用不可见的Adobe Flash影片实现剪贴板功能。我们在我们的项目的使用这一点,它工作绝对没问题。

jQuery ZeroClipBoard would probably be what you are looking for. ZeroClipBoard uses an invisible Adobe Flash movie for achieving clipboard functionality. We are using this in our project's and it is working absolutely fine.

这是很容易实现。下载一个Flash文件并将其包含在脚本文件夹中,然后按照下面的步骤。

It is easy to implement. Download a Flash file and include it in the scripts folder and follow the below steps.


  1. 添加jQuery和zClip到您的文档:

  1. Add jQuery and zClip to your document:

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.zclip.js"></script>


  • 里面的&LT; SCRIPT>块,附加zClip到这将成为你的复印按钮的元素:

  • Inside of a <script> block, attach zClip to the element which will become your "copy button":

    $(document).ready(function(){
        $('a#copy-description').zclip({
            path:'js/ZeroClipboard.swf',
            copy:$('p#description').text()
        });
        // The link with ID "copy-description" will copy
        // the text of the paragraph with ID "description"
        $('a#copy-dynamic').zclip({
            path:'js/ZeroClipboard.swf',
            copy:function(){return $('input#dynamic').val();}
        });
        // The link with ID "copy-dynamic" will copy the current value
        // of a dynamically changing input with the ID "dynamic"
    });
    


  • 这篇关于ZeroClipboard拷贝在ASP.NET MVC到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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