从下拉菜单中选择项目时更新页面上的表单

Update form on page when item selected from drop down menu

我有以下代码;

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/betatrak_db.asp" -->
<%
Dim RS_Betatrak__MMColParam
RS_Betatrak__MMColParam = "1"
If (Request.Form("RL") <> "") Then 
  RS_Betatrak__MMColParam = Request.Form("RL")
End If
%>
<%
Dim RS_Betatrak
Dim RS_Betatrak_cmd
Dim RS_Betatrak_numRows

Set RS_Betatrak_cmd = Server.CreateObject ("ADODB.Command")
RS_Betatrak_cmd.ActiveConnection = MM_betatrak_db_STRING
RS_Betatrak_cmd.CommandText = "SELECT * FROM Betatrak_Length WHERE ID = ?" 
RS_Betatrak_cmd.Prepared = true
RS_Betatrak_cmd.Parameters.Append RS_Betatrak_cmd.CreateParameter("param1", 5, 1, -1, RS_Betatrak__MMColParam) ' adDouble

Set RS_Betatrak = RS_Betatrak_cmd.Execute
RS_Betatrak_numRows = 0
%>
<%
Dim RS_Run_Length
Dim RS_Run_Length_cmd
Dim RS_Run_Length_numRows

Set RS_Run_Length_cmd = Server.CreateObject ("ADODB.Command")
RS_Run_Length_cmd.ActiveConnection = MM_betatrak_db_STRING
RS_Run_Length_cmd.CommandText = "SELECT * FROM Run_Length" 
RS_Run_Length_cmd.Prepared = true

Set RS_Run_Length = RS_Run_Length_cmd.Execute
RS_Run_Length_numRows = 0
%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <th width="45%" height="30" scope="col">Run Length</th>
    <th width="10%" scope="col">Qty</th>
    <th width="10%" scope="col">3.6M</th>
    <th width="10%" scope="col">2.4M</th>
    <th width="10%" scope="col">1.8M</th>
    <th width="10%" scope="col">1.2M</th>
  </tr>
  <tr><form name="form1" method="post" action="">
    <td><label>
      <select name="RL" id="RL">
        <option value="">- Please Select -</option>
        <%
While (NOT RS_Run_Length.EOF)
%>
<option value="<%=(RS_Run_Length.Fields.Item("ID").Value)%>"><%=(RS_Run_Length.Fields.Item("Run_Length").Value)%></option>
<%
  RS_Run_Length.MoveNext()
Wend
If (RS_Run_Length.CursorType > 0) Then
  RS_Run_Length.MoveFirst
Else
  RS_Run_Length.Requery
End If
%>
      </select>
    </label></td>
    <td><label>
      <input type="text" name="Qty" id="Qty">
    </label></td>
    <td><input name="B36" type="text" id="B36" value="<%=(RS_Betatrak.Fields.Item("B_36").Value)%>"></td>
    <td><input name="B24" type="text" id="B24" value="<%=(RS_Betatrak.Fields.Item("B_24").Value)%>"></td>
    <td><input name="B18" type="text" id="B18" value="<%=(RS_Betatrak.Fields.Item("B_18").Value)%>"></td>
    <td><label>
      <input name="B12" type="text" id="B12" value="<%=(RS_Betatrak.Fields.Item("B_12").Value)%>">
    </label></td></form>
  </tr>
</table>
</body>
</html>
<%
RS_Betatrak.Close()
Set RS_Betatrak = Nothing
%>
<%
RS_Run_Length.Close()
Set RS_Run_Length = Nothing
%>

我希望在选择 'Run Length' 时,表格会更新并显示所需的长度。

目前它不起作用,我认为这是因为我试图在同一页面上执行此操作。

这可能吗?

您需要提交可以按

完成的表格
<select name="RL" id="RL" onchange="this.form.submit()">

以便您可以将现有代码与 Request.Form("RL")

一起使用

<select name="RL" id="RL" onchange="window.location=mypage.asp?RL="+this.value;">

然后你可以使用 Request.QueryString("RL")

获得价值