转于:http://weblogs.asp.net/skillet/archive/2005/03/24/395838.aspx
<textarea rows="7" cols="49" id="box">123456789
101112
</textarea>
<script type="text/javascript">
function setCursorPosition(object, start, end) {
if (object.setSelectionRange) {
object.focus();
object.setSelectionRange(start, end);
} else if (object.createTextRange) {
var range = object.createTextRange();
range.collapse(true);
range.moveEnd("character", end);
range.moveStart("character", start);
range.select();
}
}
window.onload = function () {
setCursorPosition(document.getElementById("box"), 1, 1);
};
</script>