程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程問題解答 >> 如何制作關聯的下拉菜單?

如何制作關聯的下拉菜單?

編輯:編程問題解答

<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>

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved