将光标移动到最后

function moveEnd(obj){
    obj.focus();
    var len = obj.value.length;
    if (document.selection) {//IE
        var sel = obj.createTextRange();
        sel.moveStart('character',len);
        sel.collapse();
        sel.select();
    } 
    else if (typeof obj.selectionStart == 'number' && typeof obj.selectionEnd == 'number') {//非IE
        obj.selectionStart = obj.selectionEnd = len;
    }

}