用什么办法让这个文本域的内容总显示最下行?

来源:百度知道 编辑:UC知道 时间:2024/06/24 10:43:14
<form name="form1" method="post" action="">
<textarea name="textarea" cols="25" rows="11"></textarea>
</form>
用什么办法可以让这个文本域的内容总完整显示最下面的内容而把上面的内容缩上去呢?

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>滚动TextArea中内容到底部</title>
</head>
<body>
<textarea id="txb" rows="10">
line 01
line 02
line 03
line 04
line 05
line 06
line 07
line 08
line 09
line 10
line 11
line 12
line 13
line 14
line 15
line 16
line 17
line 18
line 19
line 20</textarea><br><button id="btn" onclick="Scroll()">Scroll To Bottom</button>
<script language="javascript">
function Scroll()
{
var txb = document.getElementById('txb');
var psnObject = txb.Span;
if ( !psnObject )
{
psnObject = document.createElement('SPAN');
txb.Span = psnObject;
}
txb.appendChild(psnObject);