<!-- <input type="text" id="test1" name="test1" value="test" onclick="moveEnd(this);" /> -->
<textarea id="test1" onclick="moveEnd(this);">nihaoaoao</textarea>
<script type="text/javascript">
function moveEnd(obj) {
obj.focus();
var len = obj.value.length;
if (document.selection) {
var sel = obj.createTextRange();
sel.moveStart('character', len);
sel.collapse();
sel.select();
} else if (typeof obj.selectionStart == 'number'&& typeof obj.selectionEnd == 'number') {
obj.selectionStart = obj.selectionEnd = len;
}
}
</script>