div中获取一段文字后面的焦点
function myfocus(obj) { if (typeof obj == 'string') obj = document.getElementById(obj); obj.focus(); if (obj.createTextRange) {//ie var rtextRange = obj.createTextRange(); if(obj.value == null || obj.value == '') return; rtextRange.moveStart('character', obj.value.length); rtextRange.collapse(true); rtextRange.select(); }else if (obj.selectionStart){//chrome "<input>"、"<textarea>" obj.selectionStart = obj.value.length; }else if(window.getSelection){ var sel = window.getSelection(); var tempRange = document.createRange(); if(obj.firstChild == null || obj.firstChild == '') return; tempRange.setStart(obj.firstChild, obj.firstChild.length); sel.removeAllRanges(); sel.addRange(tempRange);}}