2
0

form.js 529 B

12345678910111213141516
  1. function setInputSelection(input, startPos, endPos) {
  2. input.focus();
  3. if (typeof input.selectionStart != "undefined") {
  4. input.selectionStart = startPos;
  5. input.selectionEnd = endPos;
  6. } else if (document.selection && document.selection.createRange) {
  7. // IE branch
  8. input.select();
  9. var range = document.selection.createRange();
  10. range.collapse(true);
  11. range.moveEnd("character", endPos);
  12. range.moveStart("character", startPos);
  13. range.select();
  14. }
  15. }