将一个文本框的值传给另一个文本框
看代码:<textarea name="A1" cols="7" rows="9"></textarea> 文本框A1
<textarea name="A2" cols="7" rows="9"></textarea> 文本框A2
<input type="button" value="获取" onclick="这句如何写">
请问,当我点击 获取 时,如何将 A1中的值 传到 A2 中,谢谢,在表单不提交的情况下,
程序代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<textarea cols="30" rows="6" id="A"></textarea>
<textarea cols="30" rows="6" id="B"></textarea>
<input type="button" value="Copy" onclick="Copy()" />
<script>
$ = function(id) {return typeof id == 'string' ? document.getElementById(id) : id};
Copy = function() {
$('B').innerText = $('A').innerText.split("\r\n").reverse().join("\r\n")
}
</script>
</body>
</html>试试这样