设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 78|回复: 1
打印 上一主题 下一主题

帮我看看我的这个级联式下拉菜单 怎么改 急急急!!!

[复制链接]
跳转到指定楼层
1#
发表于 2010-1-19 01:08:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<script language="JavaScript">
<!--
//二级菜单
var array1[]=new array();
<%
set Conn=Server.CreateObject("ADODB.Connection")
Conn.open "Provider=sqloledb;" & "Data Source=127.0.0.1;Initial Catalog=biaobiao;User Id=sa;Password=rbgame0;"

set rs=Server.CreateObject("ADODB.RecordSet")
sql1="select * from bujian order by id"
set rs=Conn.execute(sql1)
do while not rs.eof
%>
array1[array1.length]=<%rs("bj_name")%>+"|"<%
set Conn1=Server.CreateObject("ADODB.Connection")
Conn1.open "Provider=sqloledb;" & "Data Source=127.0.0.1;Initial Catalog=biaobiao;User Id=sa;Password=rbgame0;"
sql2="select form baojia where bj_name='"&rs("bj_name")&"'"
Conn1.execute(sql2)%>
var ("array"+array1[array1.length])[][]
<%do while not Conn1.bof and Conn1.eof%>

("array"+array1[array1.length])[array1.length][("array"+array1[array1.length]).length]=Conn("pp_name")
<%response.Write Conn1("pp_name")+"^"
Conn1.movenext
loop
Conn1.close
rs.movenext
response.Write "*"
loop
Conn.close%>
var hw_selecttext=""
for(var count1=0;count1<array1.length;count1++)
{hw_selecttext=hw_selecttext+array1[count1]+"|";
for(var count2=0;i<(("array"+array1[array1.length])[array1.length][("array"+array1[array1.length]).length]);count2++)
{hw_selecttext=hw_selecttext+(("array"+array1[array1.length])[array1.length][("array"+array1[array1.length]).length])+"^";}
hw_selecttext=hw_selecttext+"*";
}
var TheSplit1 = "*" //部件之间的分隔符
var TheSplit2 = "|" //选项框的分隔符
var TheSplit3 = "^" //各个内容的分隔符
var hwallselecttext = hw_selecttext
var hwdefault_value = "cpu"
//默认值,在值有相同时有bug。
document.write('<select name="hw_1" onChange = "hw_select()"></select> <select name="hw_2" onChange = "hw_select()"></select> <input class="input" size="15" type="input" value="'+hwdefault_value+'" name="hw">\n');
var hwallselecttextarr
hwallselecttextarr = hwallselecttext.split(TheSplit1)
hwArraylength = hwallselecttextarr.length
var hwwhere = new Array(hwArraylength);
hwwhere[0]= new hw_comefrom("请选择@","请选择@");
for (var hwl=0;hwl<hwArraylength;hwl++)
{
eval(hwwhere[hwl+1] = new hw_comefrom(hwallselecttextarr[hwl].split(TheSplit2)[0],hwallselecttextarr[hwl].split(TheSplit2)[1]))
}
function hw_comefrom(hwSelect_s1,hwSelect_s2) { this.hwSelect_s1 = hwSelect_s1; this.hwSelect_s2 = hwSelect_s2; }
function hw_select()
{
with(document.all.hw_1)
{
var hwSelect_s12 = options[selectedIndex].value;
}
for(hwi = 0;hwi < hwwhere.length;hwi ++)
{
if (hwwhere[hwi].hwSelect_s1.indexOf(TheSplit4)!=-1)
{
var hwThisV = hwwhere[hwi].hwSelect_s1.split(TheSplit4)[1]
}
else
{
var hwThisV = hwwhere[hwi].hwSelect_s1
}
if (hwThisV == hwSelect_s12)
{
hwSelect_s13 = (hwwhere[hwi].hwSelect_s2).split(TheSplit3);
for(hwj = 0;hwj < hwSelect_s13.length;hwj++)
{
with(document.all.hw_2)
{
length = hwSelect_s13.length;
if (hwSelect_s13[hwj].indexOf(TheSplit4)!=-1)
{
options[hwj].text = hwSelect_s13[hwj].split(TheSplit4)[0]
options[hwj].value = hwSelect_s13[hwj].split(TheSplit4)[1]
}
else
{
options[hwj].text = hwSelect_s13[hwj];
options[hwj].value = hwSelect_s13[hwj];
}
var hwSelect_s14=options[selectedIndex].value;
}
}
break;
}
}
document.all.hw.value=hwSelect_s12+""+hwSelect_s14;
}
function hw_init()
{
with(document.all.hw_1)
{
length = hwwhere.length;
var hwm = 0
for(hwk=0;hwk<hwwhere.length;hwk++)
{
if (hwwhere[hwk].hwSelect_s1.indexOf(TheSplit4)!=-1)
{
options[hwk].text = hwwhere[hwk].hwSelect_s1.split(TheSplit4)[0];
options[hwk].value = hwwhere[hwk].hwSelect_s1.split(TheSplit4)[1];
if (hwdefault_value.indexOf(hwwhere[hwk].hwSelect_s1.split(TheSplit4)[1])!=-1){hwm = hwk}
}
else
{
options[hwk].text = hwwhere[hwk].hwSelect_s1;
options[hwk].value = hwwhere[hwk].hwSelect_s1;
if (hwdefault_value.indexOf(hwwhere[hwk].hwSelect_s1)!=-1){hwm = hwk}
}
}
selectedIndex = hwm
}
with(document.all.hw_2)
{
var hwn = 0
hwSelect_s13 = (hwwhere[hwm].hwSelect_s2).split(TheSplit3);
length = hwSelect_s13.length;
for(hwl=0;hwl<length;hwl++)
{
if (hwSelect_s13[hwl].indexOf(TheSplit4)!=-1)
{
options[hwl].text = hwSelect_s13[hwl].split(TheSplit4)[0];
options[hwl].value = hwSelect_s13[hwl].split(TheSplit4)[1];
if (hwdefault_value.indexOf(hwSelect_s13[hwl].split(TheSplit4)[1])!=-1){hwn = hwl}
}
else
{
options[hwl].text = hwSelect_s13[hwl];
options[hwl].value = hwSelect_s13[hwl];
if (hwdefault_value.indexOf(hwSelect_s13[hwl])!=-1){hwn = hwl}
}
}
selectedIndex = hwn
}
}
hw_init();
//-->
</script>
</body>
</html>

初级水平 高手请帮我改一下 我的意图是做一个二级联下拉菜单,1, 显示部件下拉 2,对象品牌下拉显示 用asp+js 数据库有 两个 一是部件名称库(部件(bujian)) 一是品牌库(部件〔bj_name〕,品牌(pp_name))
您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-18 13:41 , Processed in 0.104949 second(s), 10 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表