请教下拉列表问题
我要做一个下拉列表框name选择之后,文本框priz和enum可以显示该条记录相对应的值,提交表单后列表框name中的值成了<%=rs("prize")%>,<%=rs("num")%>,如何使列表框name的值变成本来选中的值呢,请各位高手帮忙看看,谢谢了。代码如下
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<%
path="test.mdb"
set conn = Server.CreateObject("ADODB.Connection")
str ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(path)
conn.open str
%>
<body>
<form id="form1" name="form1" method="post" action="">
name
<select name="name1" onchange="changeItem(form1.name1.value);">
<option selected="selected" value="">请选择</option>
<%
sql="select * from test4"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
%>
<option value="<%=rs("prize")%>,<%=rs("num")%>"><%=rs("name")%></option>
<%
rs.movenext
loop
%>
</select>
prize
<input name="prize" type="text" size="10" />
num
<input name="num" type="text" size="10" />
</form>
<script language="javascript">
function changeItem(p_n)
{
n=p_n.indexOf(",");
form1.prize.value=p_n.substring(0,n);
form1.num.value=p_n.substring(n+1);
}
</script>
</body>
</html>