网站地图    收藏   

主页 > 入门引导 > 网站问答 >

如何制作关联的下拉菜单?_编程10000问_

来源:自学PHP网    时间:2015-02-03 17:41 作者: 阅读:

[导读] 如何制作关联的下拉菜单?...

NEWSZW_HZH_BEGIN-->

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

 

NEWSZW_HZH_END-->

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论