<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<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>