实际上网上很多这样的源程序,自己可以去搜索,这里举两个例子供大家参考
1.普通
<script language = "javascript">
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("ASP基础","2","1");
subcat[1] = new Array("ASP应用","2","2");
subcat[2] = new Array("ASP技巧","2","3");
subcat[3] = new Array("性能优化","2","4");
subcat[4] = new Array("安全加密","2","5");
subcat[5] = new Array("XML相关","2","6");
subcat[6] = new Array("全文检索","2","7");
subcat[7] = new Array("客户端相关","2","8");
subcat[8] = new Array("打印相关","2","9");
subcat[9] = new Array("数据库相关","2","10");
subcat[10] = new Array("入门教程","3","11");
subcat[11] = new Array("FTP/HTTP/Debug","3","12");
subcat[12] = new Array("XML应用","3","13");
subcat[13] = new Array("图像处理","3","14");
subcat[14] = new Array("数据库操作","3","15");
subcat[15] = new Array("文件处理","3","16");
subcat[16] = new Array("MS Access","5","17");
subcat[17] = new Array("MS SQL","5","18");
subcat[18] = new Array("DB2","5","19");
subcat[19] = new Array("Oracle","5","20");
subcat[20] = new Array("Application/Applet","4","21");
subcat[21] = new Array("J2EE/EJB/服务器","4","22");
subcat[22] = new Array("J2ME开发","4","23");
subcat[23] = new Array("Java基础","4","24");
subcat[24] = new Array("Java技巧及代码","4","25");
subcat[25] = new Array("Jsp/Servlet","4","26");
subcat[26] = new Array("正则表达式","2","27");
subcat[27] = new Array("系统相关","2","28");
subcat[28] = new Array("组件开发","2","29");
subcat[29] = new Array("脚本编码","2","30");
subcat[30] = new Array("远程脚本","2","31");
subcat[31] = new Array("邮件相关","2","32");
subcat[32] = new Array("FSO专题","2","33");
subcat[33] = new Array(".NET概论及软件使用","1","34");
subcat[34] = new Array("Asp.Net开发","1","35");
subcat[35] = new Array("C#语言","1","36");
subcat[36] = new Array("VB.net语言","1","37");
subcat[37] = new Array("E-mail专题","1","38");
subcat[38] = new Array("WebService","1","39");
subcat[39] = new Array("winform应用","1","40");
subcat[40] = new Array("window app开发","1","41");
subcat[41] = new Array("winsock应用","1","42");
subcat[42] = new Array("XML应用","1","43");
subcat[43] = new Array("数据库应用","1","44");
subcat[44] = new Array("综合应用","1","45");
subcat[45] = new Array("OO相关","1","46");
subcat[46] = new Array("文件操作","1","47");
subcat[47] = new Array("算法/线程","1","48");
subcat[48] = new Array("软件工程","1","49");
subcat[49] = new Array("面向对象程序基础","1","50");
subcat[50] = new Array("SOAP/UDDI/WSDL","1","51");
subcat[51] = new Array("控件开发和使用","1","52");
subcat[52] = new Array("MySQL","5","53");
subcat[53] = new Array("Sybase","5","54");
subcat[54] = new Array("DataWarehouse","5","55");
subcat[55] = new Array("Replication","5","56");
subcat[56] = new Array("Performance Turning","5","57");
subcat[57] = new Array("FAQ","5","58");
subcat[58] = new Array("邮件处理","3","59");
subcat[59] = new Array("开发工具","4","60");
subcat[60] = new Array("调试手记","4","61");
subcat[61] = new Array("面向对象/设计","4","62");
subcat[62] = new Array("企业级应用","4","63");
subcat[63] = new Array("嵌入式开发","4","64");
subcat[64] = new Array("Java与XML","4","65");
subcat[65] = new Array("资料/其它","4","66");
onecount=66;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<form method="post" name="myform" action="ru_query.asp">
文章搜索:
<select name="action" size="1">
<option value="title">文章标题</option>
</select>
<select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">未指定条件</option>
<option value="1">.Net专区</option>
<option value="2">ASP技术</option>
<option value="3">PHP技术</option>
<option value="4">JSP技术</option>
<option value="5">数据库</option>
</select>
<select name="Nclassid">
<option selected value="">未指定条件</option>
</select>
<input type="text" name="keyword" class=smallinput size=10 value="关键字" maxlength="50">
<input type="submit" name="Submit" value="搜索">
</form>
2.数据库关联
<script language=javascript>
function ch(selectedids,n)
{
var selectedvalue=selectedids
var i
var t=0
document.form1.s2.length=0
for(i=0;i<n;i++)
{
if(subcat[i][0]==selectedvalue)
{
document.form1.s2.options[t]=new
Option(subcat[i][1],subcat[i][2])
t=t+1
}
}
}
function check()
{
if (document.form1.s1.options.selectedIndex==0)
{
alert("请先选择类别")
document.form1.s1.focus()
return false
}
return true
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="780" border="0" cellspacing="0" cellpadding="0"
height="38%" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<td width="19%" valign="top" bgcolor="#FFCC00"> <!--#include
file="menu3.asp" -->
</td>
<td width="81%" height="478" valign="top">
<form name="form1" method="post" action="do_mod.asp" onsubmit="return
datacheck()">
<table width="100%" border="0">
<tr bgcolor="#E6E0FE">
<td width="12%" align="center">物品类别
</td>
<td colspan="6">
<script language="javascript">
var subcat=new Array()
<%
dim n
n=0
set rs=server.CreateObject("adodb.recordset")
rs.ActiveConnection=conn
rs.Source="select a.T_catid,a.T_name as xx ,a.T_id from cos_T_manage a
join cos_T_catagery b on a.T_catid=b.T_id"
rs.CursorType=1
rs.LockType=1
rs.Open
do while not rs.EOF%>
subcat[<%=n%>]=new
Array("<%=rs("T_catid")%>","<%=rs("xx")%>","<%=rs("T_id")%>")
<%n=n+1
rs.movenext
loop
%></script>
<select name="s1"
onchange="ch(this.options[this.selectedIndex].value,<%=n%>)">
<option value="0">--请选择--</option>
<%set rsd=server.CreateObject("adodb.recordset")
rsd.ActiveConnection=conn
rsd.Source="select T_id,T_name from cos_t_catagery"
rsd.Open
do while not rsd.EOF
%>
<option value="<%=rsd("T_id")%>">
<%=rsd("T_name")%>
</option>
<%rsd.MoveNext
loop
%>
</select>
</td>
</tr>
<tr bgcolor="#E6E0FE">
<td width="12%" align="center">物品名称</td>
<td colspan="6">
<select name="s2" onclick="check()"></select>
</td>
</tr>
相关文章
- 如何在两列下拉菜单中显示子菜单
- jQuery实例——jQuery实现联动下拉列表查询框--转http://www.cnblogs.com/picaso/archive/2012/04/08/2437442.html#undefined
- 求助,关于下拉菜单
- (15)根据不同盒子和下拉菜单选择颜色,给文本赋予不同的颜色
- 页面三个txt加载联动省市县的代码,类似淘宝的收货地址的布局
- 省市联动Demo
- 关于 Swing 中下拉菜单类和复选框??????????????在线等
- 我无法弄清楚如何点击我的iFrame下拉菜单
- 开发一个jQuery插件——多级联动菜单
- 多多自走棋肯德基联动活动奖励是什么 联动CDK及奖励兑换方式详解