ASP.NET jQuery 實例4(復(fù)制TextBox的文本到本地剪貼板上)
更新時間:2012年01月13日 22:29:06 作者:
在這節(jié),我們將看到如何把多行文本框的內(nèi)容復(fù)制到剪貼板上。注意:jQuery clipboard plugin 只支持IE
在這節(jié),我們將看到如何把多行文本框的內(nèi)容復(fù)制到剪貼板上。
注意:jQuery clipboard plugin 只支持IE
界面代碼:
<form id="form1" runat="server">
<div align="center">
<fieldset style="width: 400px; height: 300px;">
<p>請輸入你的評論:</p>
<asp:TextBox ID="txtComment" TextMode="MultiLine" Rows="5" Width="300px" Height="200px"
runat="server"></asp:TextBox>
<br />
<asp:HyperLink ID="lnkHighlight" Text="點擊復(fù)制評論" runat="server"></asp:HyperLink>
</fieldset>
</div>
</form>
顯示界面:
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery.clipboard.js" type="text/javascript"></script>
<style type="text/css">
a
{
color: #0000FF;
cursor: pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$.clipboardReady(function () {
$("a").click(function () {
$("#<%=txtComment.ClientID %>").select();
$.clipboard($("#<%=txtComment.ClientID %>").val());
});
});
});
</script>
加入腳本后點擊復(fù)制按鈕顯示效果如下:
插件下載地址:http://plugins.jquery.com/project/clipboard
另外有一個Zero clipboard 插件支持跨瀏覽器,它是通過一個flash文件和JavaScirpt接口實現(xiàn)的,想了解更多信息,請訪問http://code.google.com/p/zeroclipboard/
注意:jQuery clipboard plugin 只支持IE
界面代碼:
復(fù)制代碼 代碼如下:
<form id="form1" runat="server">
<div align="center">
<fieldset style="width: 400px; height: 300px;">
<p>請輸入你的評論:</p>
<asp:TextBox ID="txtComment" TextMode="MultiLine" Rows="5" Width="300px" Height="200px"
runat="server"></asp:TextBox>
<br />
<asp:HyperLink ID="lnkHighlight" Text="點擊復(fù)制評論" runat="server"></asp:HyperLink>
</fieldset>
</div>
</form>
顯示界面:

復(fù)制代碼 代碼如下:
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery.clipboard.js" type="text/javascript"></script>
<style type="text/css">
a
{
color: #0000FF;
cursor: pointer;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$.clipboardReady(function () {
$("a").click(function () {
$("#<%=txtComment.ClientID %>").select();
$.clipboard($("#<%=txtComment.ClientID %>").val());
});
});
});
</script>
加入腳本后點擊復(fù)制按鈕顯示效果如下:

打開記事本按Ctrl+V:

插件下載地址:http://plugins.jquery.com/project/clipboard
另外有一個Zero clipboard 插件支持跨瀏覽器,它是通過一個flash文件和JavaScirpt接口實現(xiàn)的,想了解更多信息,請訪問http://code.google.com/p/zeroclipboard/
相關(guān)文章
jqPaginator結(jié)合express實現(xiàn)分頁展示內(nèi)容效果
這篇文章主要為大家詳細介紹了jqPaginator結(jié)合express實現(xiàn)分頁展示內(nèi)容效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-04-04
jQuery Easyui DataGrid點擊某個單元格即進入編輯狀態(tài)焦點移開后保存數(shù)據(jù)
這篇文章主要介紹了jQuery Easyui DataGrid點擊某個單元格即進入編輯狀態(tài)焦點移開后保存數(shù)據(jù)的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08
jQuery ajax提交Form表單實例(附demo源碼)
這篇文章主要介紹了jQuery ajax提交Form表單的方法,結(jié)合實例分析了jQuery ajax操作實現(xiàn)表單提交的相關(guān)技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2016-04-04
EasyUI的treegrid組件動態(tài)加載數(shù)據(jù)問題的解決辦法
最近涉及到treegrid組件的查詢,需要根據(jù)查詢條件動態(tài)更新EasyUI的treegrid組件的動態(tài)加載查詢結(jié)果2011-12-12

