jq 剪切板

时间:2023-03-09 09:00:20
jq 剪切板

文章链接

http://www.cnblogs.com/lkxsnow/p/5372665.html

http://www.w3cfuns.com/notes/17735/020c2e68a603420d4b431e9049be657b.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<textarea id="text" cols="50" rows="10" value="hello">输入内容点击按钮就复制好了</textarea>
<button id="btn">click</button>
<script>
window.onload=function(event){
var button=document.getElementById("btn");
button.onclick=function(event){
document.getElementById("text").select();
document.execCommand("copy",false,null);
};
};
</script>
</body>
</html>