47 lines
1.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<input type="text" id="data" value="剪切板">
<button id="copy">复制</button>
<button id="cut">剪切</button>
<!--[if IE]>
<button id="paste">粘贴</button>
<![endif]-->
<script src="../clipBoard.min.js"></script>
<script>
/**
* 复制、剪切chrome、Firefox、ie
* 粘贴ie
* @date 2016-04-25
* @return {[type]} [description]
*/
document.getElementById('copy').onclick = function() {
var test = new clipBoard(document.getElementById('data'), {
beforeCopy: function() {
alert('开始复制');
},
copy: function() {
return document.getElementById('data').value;
},
afterCopy: function() {
alert('复制成功!');
}
});
};
document.getElementById('cut').onclick = function() {
var test = new clipBoard(document.getElementById('data'), {});
test.cut();
};
document.getElementById('paste').onclick = function() {
var a = new clipBoard(document.getElementById('data'), {});
a.paste();
};
</script>
</body>
</html>