代码,
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>获取设置输入框内容</title>
</head>
<body>
<button onclick="getinput()">click me</button>
<div id="div1">
<input type="text" size="50" id="t0" value="1,2,2,13,7" />
<input type="text" size="50" id="t1" value="" />
</div>
<script>
var str="";
function getinput() {
str = document.getElementById("t0").value;
document.getElementById("t1").value = str;
}
</script>
</body>
</html>
运行如下;
单击按钮;