テキストを選択状態にする <html> <body> <span>abcdefg</span> <script type="text/javascript"> var span = document.getElementsByTagName('span')[0]; if (window.getSelection) { var range = document.createRange(); range.setStart(span.firstChild,2); range.setEnd(span.firstChild,5); var sel = getSelection(); sel.removeAllRanges(); sel.addRange(range); } else { var range = document.selection.createRange(); range.moveT