求网页按钮点击复制到剪切板代码、、

来源:百度知道 编辑:UC知道 时间:2024/07/05 04:51:01
越简单越好。。。谢啦!

<head>
<title>复制</title>
<script language="javascript">
function copyit()
{
var v=document.getElementById("t").value;
window.clipboardData.setData("text",v);
}
</script>
</head>

<body>
<textarea style="width:500px;height:100px" id="t"></textarea>
<br>
<input type="button" value="copy" onclick="copyit()" />
</body>