在表单中,通过下拉列表选择名称,而要在文本框中选择相对应的单价,应该怎么做?
谢谢!
最好能把整个页面的代码都列出来
是不是想要这样的效果?
<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>
[此贴子已经被作者于2006-1-26 9:31:32编辑过]