var field=this.get(0);
//end未定义,则为设置光标位置
if(arguments[1]==undefined){
end=start;
}
if(document.selection){
//IE
var range = field.createTextRange();
range.moveEnd(‘character’,-$(this).val().length);
range.moveEnd(‘character’,end);
range.moveStart(‘character’,start);
range.select();
}else{
//非IE
field.setSelectionRange(start,end);
$(this).focus();
}
},
/*
* 选中指定字符串
*/
iSelectStr:function(str){
var field=this.get(0);
var i=$(this).val().indexOf(str);
i != -1 ? $(this).iSelectField(i,i+str.length) : false;
},
/*
* 在光标之后插入字符串
*/
iAddField:function(str){
var field=this.get(0);
var v=$(this).val();
var len=$(this).val().length;
if(document.selection){










