S-JIS[2008-03-20] Use Script 変更履歴
JavaScriptでinputタグで作られた要素にフォーカスを当てる
(カーソルをそのボックスに移動させる)には、focus()を使う。
テキストボックス(input type=text)
に入力された文字列を選択するにはselect()を使う。
<form name="f"> <p> <input type="text" name="n1" value="111"><br> <input type="text" name="n2" value="222"><br> <input type="text" name="n3" value="333"> </p> <p> <input type="button" onclick="n2.focus();" value="n2-focus"> <input type="button" onclick="n2.select();" value="n2-select"> </p> </form>