1inp.select(); // 选中文本框中的所有文字
2function getSelectedText(text){
3if(typeof text.selectionStart == 'number'){
4 // 选择文字的起始,结束下标
5 return text.value.substring(text.selectionStart,text.selectionEnd);
6}else if(document.selecttion){// IE 取得 IE 中的选择文本代码 调用 document.selecttion 不需要考虑 text 参数
7 return document.selecttion.createRang().text;
8 }
9}