Search

8/11/2008

Javascript: How To Set Cursor to Textbox End

Javascript: How To Set Cursor to Textbox End - FF本來就會把cursor移到textarea的最後面,不過IE/chrome會把cursor移到textarea的最前面,這個技巧只要將 textarea.value = textarea.value就可以了。
http://chunghe.googlecode.com/svn/trunk/experiment/set.cursor.to.textbox.end.htm


document.onclick = function(){
var ta = document.getElementById('ta');
ta.focus();

ta.value = ta.value;
}

沒有留言: