请问列表中的options是如何使用的?
我正在学习列表的用法,但是对如何引用它当中的一行不太明白。
如下,如果将出问题的两行注释掉,可以正常运行,可这两行应该如何写才对呢?也就是说,我如何用options来引用当前选择的行呢?
<html>
<head>
<SCRIPT language="VBScript">
<!--
function chgsel()
dim thisform,sel
set thisform=document.form1
sel=thisform.select.value
sel=thisform.select.selectedindex+1
thisform.boardname.value=board(sel,1)
thisform.userlist.value=board(sel,1)
thisform.userlist.value=thisform.select.options.value
'出问题的两行
' thisform.userlist.value=thisform.select.options[sel].value
' thisform.userlist.value=thisform.select.options[sel].text
chgsel=true
end function
-->
</SCRIPT>
<SCRIPT language="VBScript">
<!--
dim board(20,5)
board(1,1)="aaaa"
board(2,1)="bbbb"
board(3,1)="cccc"
board(4,1)="dddd"
board(5,1)="eeee"
board(6,1)="ffff"
board(7,1)=""
board(1,2)="1111"
board(2,2)="2222"
board(3,2)="3333"
board(4,2)="4444"
board(5,2)="5555"
board(6,2)="6666"
-->
</SCRIPT>
</head>
<body>
<form name="form1" method="post" action="">
<p>
<select name="select" size="5" onChange="return=chgsel()">
<option value="1">aaaaaaaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
<option value="4">ddd</option>
<option value="5">eee</option>
<option value="6">fff</option>
</select>
<label></label></p>
<p>
<label>ID</label>
<input name="boardname" type="text">
<input type="text" name="userlist">
</p>
</form>
</body>
</html>