<script language = "JavaScript">
sall=new Array();
sall[0]=new Array("泉州","1","1");
sall[1]=new Array("厦门","1","2");
sall[2]=new Array("福州","1","3");
sall[3]=new Array("石狮","1","4");
sall[4]=new Array("武汉","2","5");
sall[5]=new Array("沙市","2","6");
sall[6]=new Array("孝感","2","7");
sall[7]=new Array("信阳","3","8");
sall[8]=new Array("郑州","3","9");
sall[9]=new Array("南阳","3","10");
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
var newOption1=new Option(sall[i][0],sall[i][2]);
document.all.Nclassid.add(newOption1);
}
}
}
</script>
<form method="post" name="myform" action="ru_query.asp">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">未指定条件</option>
<option value='1'>福建省</option>
<option value='2'>湖北省</option>
<option value='3'>河南省</option>
</select>
<select name="Nclassid">
<option selected value="">未指定</option>
</select>
sall=new Array();
sall[0]=new Array("泉州","1","1");
sall[1]=new Array("厦门","1","2");
sall[2]=new Array("福州","1","3");
sall[3]=new Array("石狮","1","4");
sall[4]=new Array("武汉","2","5");
sall[5]=new Array("沙市","2","6");
sall[6]=new Array("孝感","2","7");
sall[7]=new Array("信阳","3","8");
sall[8]=new Array("郑州","3","9");
sall[9]=new Array("南阳","3","10");
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
var newOption1=new Option(sall[i][0],sall[i][2]);
document.all.Nclassid.add(newOption1);
}
}
}
</script>
<form method="post" name="myform" action="ru_query.asp">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">未指定条件</option>
<option value='1'>福建省</option>
<option value='2'>湖北省</option>
<option value='3'>河南省</option>
</select>
<select name="Nclassid">
<option selected value="">未指定</option>
</select>
<html>
<head>
<title>级联下拉菜单</title>
</head>
<body onload="changelocation(document.myform.cateid.options[document.myform.cateid.selectedIndex].value)">
<form name="myform" method="post" action="Publish.asp" target="_top">
<select name="cateid" size="1">
<option selected value='1' name=cateid>网络软件</option>
<option value='2' name=cateid>系统工具</option>
<option value='3' name=cateid>应用软件</option>
<option value='6' name=cateid>多媒体类</option>
<option value='10' name=cateid>安全相关</option>
<option value='11' name=cateid>教育教学</option>
</select>
<input type=button value=">>" onClick="changelocation(document.myform.cateid.options[document.myform.cateid.selectedIndex].value)">
<select name="subcateid" size="1">
</select>
<SCRIPT language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
subcat[0] = new Array("主页浏览","3","1");
subcat[1] = new Array("书签工具","3","5");
subcat[2] = new Array("FTP 工具","1","12");
subcat[3] = new Array("系统增强","2","13");
subcat[4] = new Array("系统设置","2","14");
subcat[5] = new Array("系统备份","2","15");
subcat[6] = new Array("桌面工具","2","16");
subcat[7] = new Array("压缩解压","3","21");
subcat[8] = new Array("文件管理","3","22");
subcat[9] = new Array("文件更名","3","24");
subcat[10] = new Array("电子阅读","3","27");
subcat[11] = new Array("媒体播放","6","42");
subcat[12] = new Array("音频处理","6","43");
subcat[13] = new Array("下载工具","1","60");
subcat[14] = new Array("系统安全","10","61");
subcat[15] = new Array("网吧管理","10","63");
subcat[16] = new Array("网络安全","10","64");
subcat[17] = new Array("教育管理","11","66");
subcat[18] = new Array("邮件工具","1","72");
onecount=19;
changelocation(1);function changelocation(locationid)
{
document.myform.subcateid.length = 0; var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.subcateid.options[document.myform.subcateid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
</form>
</body>
</html>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD><BODY>
<form action="ddnsqd_cl.asp" method=post name=ddnsqd>
<td><SELECT name=xSXJS style="BACKGROUND-COLOR: #90E0FF; WIDTH: 50pt;" onchange="changes(this.value,'J');">
<OPTION value=""></OPTION>
<OPTION value="北京">北京</OPTION>
<OPTION value="上海">上海</OPTION>
<OPTION value="湖北">湖北</OPTION>
<OPTION value="辽宁">辽宁</OPTION>
<OPTION value="陕西">陕西</OPTION>
<OPTION value="四川">四川</OPTION>
<OPTION value="江苏">江苏</OPTION>
<OPTION value="广东">广东</OPTION>
<OPTION value="天津">天津</OPTION>
<OPTION value="甘肃">甘肃</OPTION>
<OPTION value="重庆">重庆</OPTION>
<OPTION value="河北">河北</OPTION>
<OPTION value="山东">山东</OPTION>
<OPTION value="山西">山西</OPTION>
<OPTION value="河南">河南</OPTION>
<OPTION value="吉林">吉林</OPTION>
<OPTION value="黑龙江">黑龙江</OPTION>
<OPTION value="安徽">安徽</OPTION>
<OPTION value="浙江">浙江</OPTION>
<OPTION value="江西">江西</OPTION>
<OPTION value="福建">福建</OPTION>
<OPTION value="贵州">贵州</OPTION>
<OPTION value="广西">广西</OPTION>
<OPTION value="海南">海南</OPTION>
<OPTION value="云南">云南</OPTION>
<OPTION value="内蒙古">内蒙古</OPTION>
<OPTION value="青海">青海</OPTION>
<OPTION value="新疆">新疆</OPTION>
<OPTION value="宁夏">宁夏</OPTION>
<OPTION value="西藏">西藏</OPTION>
<OPTION value="湖南">湖南</OPTION>
</SELECT></td>
<td><SELECT name=xSXJI style="BACKGROUND-COLOR: #90E0FF; WIDTH: 50pt;" onchange="changei(document.all.xSXJS.value,this.value,'J');"></SELECT></td>
<td><SELECT name=xSXJX style="BACKGROUND-COLOR: #90E0FF; WIDTH: 50pt;" onchange="changex(this.value,'J');"></SELECT></td>
</form> <SCRIPT LANGUAGE=javascript>
<!--
function changeg(guo,fx)
{
document.all.item('SX'+fx+'G').value=guo;
document.all.item('SX'+fx+'S').value='';
document.all.item('SX'+fx+'I').value='';
document.all.item('SX'+fx+'X').value='';
document.all.item('xSX'+fx+'S').value='';
changes('',fx);
}
function changes(sheng,fx)
{
var pos,sh,s,i,op;
document.all.item('xSX'+fx+'I').options.length=0;
document.all.item('xSX'+fx+'X').options.length=0;
if(sheng!='')
{
sh=document.all.shi.value;
pos=sh.indexOf('|'+sheng+'|');
if(pos>=0)
{
pos=pos+('|'+sheng+'|').length;
sh=sh.substring(pos,sh.indexOf('|',pos));
//将数据导入下拉框中
s=sh.split(' ');
for(i=0;i<s.length;i++)
{
op=document.createElement('option');
op.text=s[i];
op.value=s[i];
document.all.item('xSX'+fx+'I').add(op);
}
}
}
}
function changei(sheng,shi,fx)
{
var pos,po,sh,s,i,op;
document.all.item('xSX'+fx+'X').options.length=0;
if(sheng!='')
{
sh=document.all.xian.value;
pos=sh.indexOf("|"+sheng+"|");
if(pos>=0)
{
pos=pos+("|"+sheng+"|").length;
po=sh.indexOf("|"+shi+"!",pos);
if(po>=pos)
{
po=po+("|"+shi+"!").length;
sh=sh.substring(po,sh.indexOf("|",po))
//将数据导入下拉框中
s=sh.split(" ");
for(i=0;i<s.length;i++)
{
op=document.createElement("option");
op.text=s[i];
op.value=s[i];
document.all.item('xSX'+fx+'X').add(op);
}
}
}
}}
function changex(xian,fx)
{}
function showydxx(djsx,dllb)
{
if(dllb=='备份电路')
{
ydxx.style.display='';
document.all.item('SAYDDBH').style.backgroundColor=document.all.item('SAYDDH').style.backgroundColor=document.all.item('SAYDLDH').style.backgroundColor=document.all.item('SAYJKSL').style.backgroundColor=document.all.item('SAYJZXH').style.backgroundColor=document.all.item('SAYYZXH').style.backgroundColor=document.all.item('SAYDLLY').style.backgroundColor='';
document.all.item('SAYDDBH').disabled=document.all.item('SAYDDH').disabled=document.all.item('SAYDLDH').disabled=document.all.item('SAYJKSL').disabled=document.all.item('SAYJZXH').disabled=document.all.item('SAYYZXH').disabled=document.all.item('SAYDLLY').disabled=false;
}
else if(djsx!='新装')
{
ydxx.style.display='';
document.all.item('SAYDDBH').style.backgroundColor=document.all.item('SAYDDH').style.backgroundColor=document.all.item('SAYDLDH').style.backgroundColor=document.all.item('SAYJKSL').style.backgroundColor=document.all.item('SAYJZXH').style.backgroundColor=document.all.item('SAYYZXH').style.backgroundColor=document.all.item('SAYDLLY').style.backgroundColor='';
document.all.item('SAYDDBH').disabled=document.all.item('SAYDDH').disabled=document.all.item('SAYDLDH').disabled=document.all.item('SAYJKSL').disabled=document.all.item('SAYJZXH').disabled=document.all.item('SAYYZXH').disabled=document.all.item('SAYDLLY').disabled=false;
}
else
{
ydxx.style.display='none';
document.all.item('SAYDDBH').style.backgroundColor=document.all.item('SAYDDH').style.backgroundColor=document.all.item('SAYDLDH').style.backgroundColor=document.all.item('SAYJKSL').style.backgroundColor=document.all.item('SAYJZXH').style.backgroundColor=document.all.item('SAYYZXH').style.backgroundColor=document.all.item('SAYDLLY').style.backgroundColor='#90E0FF';
document.all.item('SAYDDBH').disabled=document.all.item('SAYDDH').disabled=document.all.item('SAYDLDH').disabled=document.all.item('SAYJKSL').disabled=document.all.item('SAYJZXH').disabled=document.all.item('SAYYZXH').disabled=document.all.item('SAYDLLY').disabled=true;
}
}
function changeJS(sheng,fx)
{
var pos,sh,s,i,op;
document.all.item('SAZ'+fx+'JI').options.length=0;
document.all.item('SAZ'+fx+'JX').options.length=0;
if(sheng!='')
{
sh=document.all.shi.value;
pos=sh.indexOf('|'+sheng+'|');
if(pos>=0)
{
pos=pos+('|'+sheng+'|').length;
sh=sh.substring(pos,sh.indexOf('|',pos));
//将数据导入下拉框中
s=sh.split(' ');
for(i=0;i<s.length;i++)
{
op=document.createElement('option');
op.text=s[i];
op.value=s[i];
document.all.item('SAZ'+fx+'JI').add(op);
}
}
}
}
function changeJI(sheng,shi,fx)
{
var pos,po,sh,s,i,op;
document.all.item('SAZ'+fx+'JX').options.length=0;
if(sheng!='')
{
sh=document.all.xian.value;
pos=sh.indexOf("|"+sheng+"|");
if(pos>=0)
{
pos=pos+("|"+sheng+"|").length;
po=sh.indexOf("|"+shi+"!",pos);
if(po>=pos)
{
po=po+("|"+shi+"!").length;
sh=sh.substring(po,sh.indexOf("|",po))
//将数据导入下拉框中
s=sh.split(" ");
for(i=0;i<s.length;i++)
{
op=document.createElement("option");
op.text=s[i];
op.value=s[i];
document.all.item('SAZ'+fx+'JX').add(op);
}
}
}
}
}
//-->
</SCRIPT> </td>
</tr>
<tr height=10><td></td></tr>
</table>
</form>
</body>
<HEAD>
<SCRIPT language=JavaScript> SubMenuinfo = new Array(
new Array(
new Array("产品1-1", 39482304),
new Array("产品1-2", 34802389),
new Array("产品1-3", 39823498),
new Array("产品1-4", 87587343),
new Array("产品1-5", 68798735),
new Array("产品1-6", 98098509),
new Array("产品1-7", 49490583),
new Array("产品1-8", 32898334),
new Array("产品1-9", 92340934),
new Array("产品1-10", 34923409),
new Array("产品1-11", 59384093)
),
new Array(
new Array("产品2-1", 23840238),
new Array("产品2-2", 92390484),
new Array("产品2-3", 29048203),
new Array("产品2-4", 94098230),
new Array("产品2-5", 39234923),
new Array("产品2-6", 29345423),
new Array("产品2-7", 24890234),
new Array("产品2-8", 92349823)
),
new Array(
new Array("产品3-1", 39482304),
new Array("产品3-2", 34802389),
new Array("产品3-3", 39823498),
new Array("产品3-4", 87587343),
new Array("产品3-5", 68798735),
new Array("产品3-6", 98098509),
new Array("产品3-7", 49490583),
new Array("产品3-8", 32898334),
new Array("产品3-9", 92340934),
new Array("产品3-10", 34923409),
new Array("产品3-11", 59384093)
),
new Array(
new Array("产品4-1", 20394802),
new Array("产品4-2", 34982039),
new Array("产品4-3", 92348902),
new Array("产品4-4", 98203894),
new Array("产品4-5", 98234902),
new Array("产品4-6", 52938409)
)
); function fillSelectFromArray(selectCtrl, itemArray, goodPrompt, badPrompt, defaultItem) {
var i, j;
var prompt;
for (i = selectCtrl.options.length; i >= 0; i--) {
selectCtrl.options[i] = null;
}
prompt = (itemArray != null) ? goodPrompt : badPrompt;
if (prompt == null) {
j = 0;
} else {
selectCtrl.options[0] = new Option(prompt);
j = 1;
}
if (itemArray != null) { for (i = 0; i < itemArray.length; i++) {
selectCtrl.options[j] = new Option(itemArray[i][0]);
if (itemArray[i][1] != null) {
selectCtrl.options[j].value = itemArray[i][1];
}
j++;
} selectCtrl.options[0].selected = true;
}
}
</SCRIPT>
<title>下拉菜单</title>
<style type="text/css">
<!--
body { font-size: 9pt; margin-top: 0px}
td { font-size: 9pt}
.menu { font-family: "黑体"; font-size: 9pt; background-color: #CCCCFF}
-->
</style> <BODY bgcolor="#FFFFFF" text="#000000">
<p align="center">
</p> <table width="550" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="#F5F5F5">
<tr>
<td>
<form name="main" method="post" action="collect.asp"" target="_blank">
<div align="center">
<select
onChange="fillSelectFromArray(this.form.SubMenu, ((this.selectedIndex == -1) ? null : SubMenuinfo[this.selectedIndex-1]));" name=MainMenu class="menu">
<option value=-1 selected>选择产品分类
<option value="分类1">产品分类1
<option value="分类2">产品分类2
<option value="分类3">产品分类3
<option value="分类4">产品分类4 </option>
</select>
<select size=1 name=SubMenu class="menu">
<option>---------------</option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
<input type="submit" value="查询" name="submit">
</div>
</form>
</td>
</tr>
</table> </BODY>
</HTML> 自己手动添加一下拉,应该可以实现的!
<html>
<head>
<title> 省市县关联菜单 </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Generator" content="EditPlus">
<style>
body,select
{
font-size:9pt;
font-family:Verdana;
}
select {background-color:#F0F0F0;}
</style>
<script language="JavaScript" src="script/area.js"></script>
<SCRIPT LANGUAGE = JavaScript>
<!--
var s=["s1","s2","s3"];
var opt0 = ["省份","地级市","市、县级市、县"];
function setup()
{
for(i=0;i<s.length-1;i++)
document.getElementById(s[i]).onchange=new Function("change("+(i+1)+")");
change(0);
}
//-->
</SCRIPT>
</head>
<body bgcolor="#E0E0E0" onload="setup()">
多级关联菜单:
<form name="frm">
<select id="s1"></select>
<select id="s2"></select>
<select id="s3"></select>
</form></body>
</html>
--------------------------------------------------------------------------------
回这个贴真是辛苦,说太长要分开回复,郁闷啊,先回复的是HTML。下面是JS的程序等候。。
function Dsy() { this.Items = {}; }
Dsy.prototype.add = function(id,iArray) { this.Items[id] = iArray; }
Dsy.prototype.Exists = function(id) { if(typeof(this.Items[id]) == "undefined") return false; return true; };
function change(v){
var str="0";
for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));};
var ss=document.getElementById(s[v]);
with(ss){
length = 0;
options[0]=new Option(opt0[v],opt0[v]);
if(v && document.getElementById(s[v-1]).selectedIndex>0 || !v)
{
if(dsy.Exists(str)){
ar = dsy.Items[str];
for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]);
if(v)options[1].selected = true;
}
}
if(++v<s.length){change(v);}
}
}
var dsy = new Dsy();<!-- 还有哈-->
dsy.add("0_0_1",["东市区","固镇县","怀远县","郊区","市辖区","五河县","西市区","中市区"]);
dsy.add("0_0_2",["巢湖市","含山县","和县","庐江县","无为县"]);
dsy.add("0_0_3",["东至县","贵池市","青阳县","石台县"]);
下面的县市数组照这样定义就可以了,我一贴它说太长,如果你们谁想省事就给我发邮件:[email protected]或QQ:10386693
谢谢
[email protected]
msn : [email protected]
[email protected]