<!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>js实现复制文本框内容</title>
<script type="text/javascript">
//复制的方法
function copy(){
//获得第一个文本框的值
var x=document.getElementById("one").value;
//把第一个文本框的值赋值给第二个文本框
document.getElementById("two").value=x;
//清空第一个文本框
document.getElementById("one").value="";
}
</script>
</head>
<body>
<input type="text" id="one"/>
<input type="text" id="two"/>
<input type="button" value="复制" onclick="copy()" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>js实现复制文本框内容</title>
<script type="text/javascript">
//复制的方法
function copy(){
//获得第一个文本框的值
var x=document.getElementById("one").value;
//把第一个文本框的值赋值给第二个文本框
document.getElementById("two").value=x;
//清空第一个文本框
document.getElementById("one").value="";
}
</script>
</head>
<body>
<input type="text" id="one"/>
<input type="text" id="two"/>
<input type="button" value="复制" onclick="copy()" />
</body>
</html>