如何制作关联的下拉菜单?

时间:2021-05-18

<form name=f1 METHOD="POST">

<%

OpenDB objConn, "xxxx"

Set RSClass = objConn.Execute("select * from class Order by fldClass")

If RSClass.EOF Then

Response.Write "噢,没有记录!<BR>"

Else

Response.Write "<select NAME=""class"" style=""FONT-SIZE: 9pt"" SIZE=10"

" ONCHANGE=""classselected(this);"" >"

sjavascript = "function classselected(elem){" &_

vbCrlf

"for (var i = document.f1.sort.options.length; i >= 0; i--){"

"document.f1.sort.options[i] = null;"

vbCrlf

Do Until RSClass.EOF

If sLastClass <> RSClass("fldClass") Then

sLastClass = RSClass("fldClass")

Response.Write "<OPTION VALUE=" & RSClass("fldID") & ">" & sLastClass & "</OPTION>"

sjavascript = sjavascript & "}"

"if (elem.options[elem.selectedIndex].value=="

RSClass("fldID") & "){"

End If

sjavascript = sjavascript

"document.f1.sort.options[document."

"f1.sort.options.length] = new Option('"

RSClass("fldSort") & "','" & RSClass("fldID") & "');"

vbCrlf

RSClass.MoveNext

Loop

Response.Write "</select>"

Response.Write "<select NAME=""sort"" style=""FONT-SIZE: 9pt"" SIZE=10>"

Response.Write "<OPTION>请选择</OPTION>"

Response.Write "</select>"

 

sjavascript = sjavascript & "}" & "}"

Response.Write "<SCR" & "IPT LANGUAGE=""javascript"">"

Response.Write sjavascript & "</SCR" & "IPT>"

End If

RSClass.Close

Set RSClass = Nothing

%>

</form>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章