将光标定位在text,textarea最后的步骤

将光标定位在text,textarea最后的方法var setpos function(o){if (o.setSelectionRange) {setTimeout(fu

将光标定位在text,textarea最后的方法

var setpos = function(o){   if (o.setSelectionRange) {       setTimeout(function(){      o.setSelectionRange(o.value.length, o.value.length);        o.focus()} ,0)   }else if (o.createTextRange) {    var textrange=o.createTextRange();    textrange.moveStart("character",o.value.length);    textrange.moveEnd("character",0);    textrange.select();  }  };