JS基于clipBoard.js插件實現(xiàn)剪切、復(fù)制、粘貼
來源:易賢網(wǎng) 閱讀:1226 次 日期:2016-07-06 10:59:37
溫馨提示:易賢網(wǎng)小編為您整理了“JS基于clipBoard.js插件實現(xiàn)剪切、復(fù)制、粘貼”,方便廣大網(wǎng)友查閱!

這篇文章主要介紹了JS實現(xiàn)剪切、復(fù)制、粘貼——clipBoard.js 的相關(guān)資料,需要的朋友可以參考下

摘要:

最近做了一個項目,其中有這樣一需求:實現(xiàn)一個點擊按鈕復(fù)制鏈接的功能,通過網(wǎng)上找相關(guān)資料,找到了幾個插件,ZeroClipboard是通過flash實現(xiàn)的復(fù)制功能,隨著越來越多的提議廢除flash,于是就想能不能通過js來實現(xiàn)復(fù)制剪切呢?

地址:https://github.com/baixuexiyang/clipBoard.js

方法:

復(fù)制

var copy = new clipBoard(document.getElementById('data'), {

beforeCopy: function() {

},

copy: function() {

return document.getElementById('data').value;

},

afterCopy: function() {

}

});

剪切

var cut = new clipBoard(document.getElementById('data'), {

beforeCut: function() {

},

Cut: function() {

return document.getElementById('data').value;

},

afterCut: function() {

}

});

粘貼

var paste = new clipBoard(document.getElementById('data'), {

beforePaste: function() {

},

paste: function() {

return document.getElementById('data').value;

},

afterPaste: function() {

}

});

更多信息請查看網(wǎng)絡(luò)編程
由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點

版權(quán)所有:易賢網(wǎng)