一个强健 实用的asp+ajax二级联动菜单(有演示和附(2)
</div>
<div id="subclass" style="float:left"><select name="select2">
<option value="0">选择二级分类</option>
</select>
</div>
</form>
</body>
</html>
getsubcategory.asp文件:
复制代码 代码如下:
<%
Response.Charset="GB2312" '设置字符集 原默认为utf-8
bigclassid=safe(request.QueryString("bigclassid")) '非法字符过滤
If bigclassid<>"" Then
Set Re=New RegExp
Re.IgnoreCase=true
Re.Global=false
Re.Pattern = "^[0-9]{1,3}$"
If Not Re.Test(bigclassid) Then
Response.Write "非法参数"
Response.End
End If%>
<!--#include file="iconn.asp"-->
<%On error Resume Next
set p = conn.execute("select * from smallclass where bigclassid="&bigclassid&"")
If Err Then
Err.Clear
Response.Write "查询出错"
Response.End
End If
If Not p.Eof Then
html = "<select name='smallclassid'>"&vbnewline
Do While Not p.Eof
html = html&"<option value='"&p("smallclassid")&"'>"&p("smallclassname")&"</option>"&vbnewline
p.Movenext
Loop
html = html&"</select>"
Else
html = "<select name='smallclassid'><option value='0' selected>暂无小类</option></select>"
End If
p.Close
Set p = Nothing
Conn.Close
Set Conn = Nothing
内容版权声明:除非注明,否则皆为本站原创文章。