<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>點擊復制功能的實現</title>
</head>
<body>
<script type="text/javascript">
function copyUrl2() {
var Url2 = document.getElementById("biao1");
Url2.select(); // 選擇對象
document.execCommand("Copy"); // 執行瀏覽器復制命令
alert("已復制好,可貼粘。");
}
</script>用戶定義的代碼區域
<textarea cols="20" rows="10" id="biao1">用戶定義的代碼區域</textarea>
<input type="button" onClick="copyUrl2()" value="點擊復制代碼" />
</body>
</html>
