javascript 选中select中的某个元素(初学者)
<html><head><title>test.................</title><script language="javascript">function xjh() {var IdType = document.getElementsByName("IdType");for (var i = 0; i < IdType[0].length; i++) {if (IdType[0].options[i].value == 2) {IdType[0].options[i].selected = true;}}}</script></head><body onload="xjh()"><form name='form1'><select name="IdType"><option value="1">身份证</option><option value="2" >户口本</option><option value="3" >士官长</option></select></form></body></html>