功能:新建一个简单的网页,可以将一些需要频繁复制粘贴的东西放在里边。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body>
<input name="text" id="text" cols="30" rows="10"></input>
<button οnclick="myCopy1()">点击复制文本框内的内容</button><br>
<input name="text" id="text1" cols="30" rows="10"></input>
<button οnclick="myCopy2()">点击复制文本框内的内容</button><br>
<input name="text" id="text2" cols="30" rows="10"></input>
<button οnclick="myCopy3()">点击复制文本框内的内容</button><br>
<input name="text" id="text3" cols="30" rows="10"></input>
<button οnclick="myCopy4()">点击复制文本框内的内容</button><br>
<input name="text" id="text4" cols="30" rows="10"></input>
<button οnclick="myCopy5()">点击复制文本框内的内容</button><br>
<input name="text" id="text5" cols="30" rows="10"></input>
<button οnclick="myCopy6()">点击复制文本框内的内容</button><br>
<input name="text" id="text6" cols="30" rows="10"></input>
<button οnclick="myCopy7()">点击复制文本框内的内容</button><br>
<script>
function myCopy1(){
var ele = document.getElementById("text");
ele.select();
document.execCommand("Copy");
}
function myCopy2(){
var ele = document.getElementById("text1");
ele.select();
document.execCommand("Copy");
}
function myCopy3(){
var ele = document.getElementById("text2");
ele.select();
document.execCommand("Copy");
}
function myCopy4(){
var ele = document.getElementById("text3");
ele.select();
document.execCommand("Copy");
}
function myCopy5(){
var ele = document.getElementById("text4");
ele.select();
document.execCommand("Copy");
}
function myCopy6(){
var ele = document.getElementById("text5");
ele.select();
document.execCommand("Copy");
}
function myCopy7(){
var ele = document.getElementById("text6");
ele.select();
document.execCommand("Copy");
}
</script>
</body>
</html>
效果: