怎样得到文本框中文字的行数?或回车的数量?最快的算法!

能不能直接得到?
---------------------------------------------------------------

回車數:

1<textarea id="t1"></textarea>
1<input name="Button" onclick="alert(document.all('t1').innerHTML.split('\n').length - 1)" type="button" value="Button"/>

---------------------------------------------------------------

1<textarea cols="50" id="t1" rows="10"></textarea>
1<input name="Button" onclick="alert(document.all('t1').value.split('\n').length)" type="button" value="Button"/>
Published At
Categories with Web编程
comments powered by Disqus