リストボックスの指定行を選択する
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <script type="text/javascript"> <!-- function def8(){ document.forms["f1"].elements["listB"].options[7].selected = true; } function def1(){ document.forms["f1"].elements["listB"].options[7].selected = false document.forms["f1"].elements["listB"].options[0].selected = true; } //--> </script> </head> <body> <form name="f1"> <input type="button" name="btn2" value="8行目" onClick="def8()" > <input type="button" name="btn1" value="1行目" onClick="def1()"> <select size="3" name="listB" > <option value="1" selected>1行目</option> <option value="2">2行目</option> <option value="3">3行目</option> <option value="4">4行目</option> <option value="5">5行目</option> <option value="6">6行目</option> <option value="7">7行目</option> <option value="8">8行目</option> <option value="9">9行目</option> </select> </form> </body> </html>