| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1740 人关注过本帖
标题:[求助]二级连动下拉列表框
只看楼主 加入收藏
flyingboy
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-3-15
收藏
 问题点数:0 回复次数:6 
[求助]二级连动下拉列表框
如题,谢谢各位啦~~~~~~~~~~~
搜索更多相关主题的帖子: 列表 连动 
2006-03-15 18:54
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 

[CODE]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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>

<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();

subcat[0] = new Array("单面胶带","7829","8044");

subcat[1] = new Array("电工胶带","7829","8045");

subcat[2] = new Array("金属胶带","7829","8050");

subcat[3] = new Array("屏蔽胶带","7829","8051");

subcat[4] = new Array("屏蔽/导电衬垫","10444","10446");

subcat[5] = new Array("保护类胶带","12104","12105");

subcat[6] = new Array("遮蔽类胶带","12104","12532");

subcat[7] = new Array("VHB胶带","12533","12534");

subcat[8] = new Array("双面泡棉胶带","12533","12535");

subcat[9] = new Array("薄型双面胶带","12533","12992");

subcat[10] = new Array("厚型双面胶带","12533","12993");

subcat[11] = new Array("结构粘接胶带","12533","13823");

subcat[12] = new Array("热粘胶带","12533","13824");

subcat[13] = new Array("双面胶带","12533","13825");

subcat[14] = new Array("双面胶膜","12533","13826");

subcat[15] = new Array("ATG薄膜胶","12533","13827");

subcat[16] = new Array("导电及导热胶带","12533","13829");

subcat[17] = new Array("光学透明胶膜","12533","13830");

subcat[18] = new Array("可重复粘贴/暂时固定胶带","12533","13832");

subcat[19] = new Array("工业扣件系列","12533","13833");

subcat[20] = new Array("结构型胶粘剂","14977","14978");

subcat[21] = new Array("快干胶","14977","14981");

subcat[22] = new Array("接触型胶粘剂","14982","14984");

subcat[23] = new Array("塑料和橡胶胶粘剂","14982","14987");

subcat[24] = new Array("喷胶","14982","14991");

subcat[25] = new Array("热熔胶和胶枪","14982","14994");

subcat[26] = new Array("纤维胶带","12104","15233");

subcat[27] = new Array("环氧薄膜胶带","15235","15236");

subcat[28] = new Array("聚酰亚胺薄膜胶带","15235","15237");

subcat[29] = new Array("防静电胶带","15235","15238");

subcat[30] = new Array("聚四氟乙烯薄膜胶带","15235","15239");

subcat[31] = new Array("聚酯薄膜胶带","15235","15240");

subcat[32] = new Array("醋酸酯布胶带","15235","15241");

subcat[33] = new Array("合成薄膜胶带","15235","15242");

subcat[34] = new Array("玻璃布胶带","15235","15243");

subcat[35] = new Array("报事贴","19181","19182");

subcat[36] = new Array("胶带及切割座","19181","19183");

subcat[37] = new Array("优视灯","19181","19184");

subcat[38] = new Array("电脑屏幕/键盘清洁剂","19181","19222");

onecount=39;
function changelocation(locationid)
{
document.form1.Nclassid.length = 0;
var locationid=locationid;
var i;
document.form1.Nclassid.options[0] = new Option('请选择二类',0); //二级列表的第一项:显示请选择二类,若选择的值为0
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.Nclassid.options[document.form1.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}
</script>
<form action="cp_cx.asp?cardid=J0002049" name="form1" method="post" >
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td>

<select name="classid" size="1" class="form1" onChange="changelocation(document.form1.classid.options[document.form1.classid.selectedIndex].value)">


<option value=0 selected>一级分类</option>

<option value="7829">胶带</option>

<option value="8048">热缩套管</option>

<option value="8049">环氧粉末</option>

<option value="10444">屏蔽材料</option>

<option value="12104">单面胶带</option>

<option value="12533">双面胶带</option>

<option value="12994">汽车胶带(丙烯酸泡棉双面胶带)</option>

<option value="14977">结构型胶粘剂</option>

<option value="14982">非结构型胶粘剂</option>

<option value="15235">特种电气胶带</option>

<option value="19181">文具类产品</option>

</select> <select name="Nclassid" size="1" class="form1">
<option value=0 selected>二级分类</option>
</select>

</form>
</BODY>
</HTML>[/CODE]

怎么javascript版人气这么差?我这个老版主真的看不下去了。


2006-03-16 22:43
linuxpluto
Rank: 4
等 级:贵宾
威 望:13
帖 子:889
专家分:23
注 册:2005-8-14
收藏
得分:0 

呵呵,我闲了一点,来看看,这样的代码以前多的是


吃的比猪还差,干的比驴还累,起的比鸡还早,睡得比小姐还晚,挣得比民工还少,看起来比谁都好——苦命的人.人生短短几十年,不要给自己留下了什么遗憾,想笑就笑,想哭就哭,该爱的时候就去爱,无谓压抑自己
2006-03-26 22:47
liqiang01
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-3-21
收藏
得分:0 
这样哪有什么用,你这是固定了数据啊,如果我要从数据库中读取数据呢?你怎么写代码?
2006-04-29 15:17
nightheart
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-3-13
收藏
得分:0 
前两天才写了一个,方法是服务器一次打印所有的二级下拉列表在数个DIV中,但只显示(display:)其中的一个DIV,其他的全部display:none,单击一级下拉列表后判断第几个被选中,然后显示对应层,隐藏其他层
2006-04-30 11:47
nightheart
Rank: 1
等 级:新手上路
帖 子:54
专家分:0
注 册:2006-3-13
收藏
得分:0 
代码在这里
function chgSel()
{
var MX,CT;
MX=document.getElementById('select0').options.length;
for (var j=0;j<=MX-1;j++)
{
var tem=eval("document.getElementById('select0').options["+j+"].selected");
if(tem==true)
{
CT=j+1;
}
}
for (var i=1;i<=MX;i++)
{
tid="S"+i;
if (i==CT)
{
document.getElementById(tid).style.display="";
}
else if(i!=CT)
{
document.getElementById(tid).style.display="none";
}
}
}
2006-04-30 11:55
程序错误
Rank: 1
等 级:新手上路
帖 子:52
专家分:0
注 册:2006-4-30
收藏
得分:0 

动态的二级菜单的内容是存在JS数组中的,可以从数据库中循环提取


天因你而更蔚蓝~~~~~~
地狱因我而黑暗~~~~~~
2006-04-30 16:04
快速回复:[求助]二级连动下拉列表框
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016707 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved