首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

jsp三级联动加数据库的一些有关问题(急)

2011-12-12 
jsp三级联动加数据库的一些问题(急)三级联动基本功能可以实现,但有点问题,当选择第一个下拉框时,第二个下

jsp三级联动加数据库的一些问题(急)
三级联动基本功能可以实现,但有点问题,当选择第一个下拉框时,
第二个下拉框会随着改变,但第三个下拉框不会随着变化。
代码如下:
<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="stella.eip.UserInfo"%>
<%@ page import="stella.eip.UserAction"%>
<%@ include file="checkSession.jsp"%>
<HTML>
<HEAD>
<TITLE>新增用户</TITLE>
<LINK href="../Inc/css.css" type="text/css" rel=stylesheet>
<SCRIPT language=JavaScript src="../Inc/msg.js"></SCRIPT>
<link rel="StyleSheet" href="../Inc/dtree.css" type="text/css" />
<script type="text/javascript" src="dtree.js"></script>
<script language="javascript">
<!--
function addVendor(a) { document.addUserForm.EIPSYS.value=a; }
//-->
</script>
</HEAD>
<jsp:useBean id="OracleConn" scope="application" class="stella.eip.OracleConn"/>
<body leftmargin="0" topmargin="0">
<script language="javascript">
<!--
document.write(userAddress("<fmt:message key="seat"/> : 用户管理 >> 修改用户"));
//-->
</script><br>
<%
UserInfo uInfo = (UserInfo)session.getAttribute("EIP_USERINFO");
String addMan = uInfo.getUserLogin();
String addAdmin = uInfo.getUserAdmin();
String userid = request.getParameter("userid");

if(addAdmin.equals("Y")||addAdmin.equals("M")||userid!=null){

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String userip = request.getRemoteAddr();
String userlogin ="",username="",mailserver="",internetadd="",companyname="",factno="";
int deptid=0;
int userlock=0;
int teamid=0;
int interview=0;
int ye=0;
int eipsys=0;
String smanager="",phone="",userfactid="",otheradmin="";

try{
conn = OracleConn.getConnection();//连接数据库
stmt = conn.createStatement();
  ye=1;
factno="WE"; //上个页面传递过来的参数
deptid=1; //上个页面传递过来的参数

if(ye==1){
%>
<script language="JavaScript">  
  var onecount;  
  onecount=0;  
  subcat =new Array(); // 建立数组
<% 
int count;
rs=stmt.executeQuery("SELECT A.DID,A.DEPTNAME,B.FACTNO FROM EIP_DEPT A,EIP_FACT B WHERE A.FID=B.FID ORDER BY A.DID "); //打开数据库,这里我用的是javabean链接JDBC的方法
count=0;
while(rs.next())

%>  
subcat[<%=count%>] = new Array("<%=rs.getString(1)%>","<%=rs.getString(2)%>","<%=rs.getString(3)%>"); //给数组赋值,其中rs0.getString(1)代表第1字段,这里不要搞错字段哦
<%
count=count+1;
}
rs.close();
%>
onecount=<%=count%>;
function changelocation(id) //实现函数
  {
  document.addUserForm.DEPTID.length = 0; 
  var id=id;
  var i;//如果i从1循环那么记录中第1行的信息就看不到了
  for (i=0;i<onecount; i++) //从数组的第1行算起 查找id ,这里的id是你大类的id(下面有我的数组例子)
  {
  if (subcat[i][2] ==id) //第一次循环从第1行,第3列,那1列是大类ID
  { 
  document.addUserForm.DEPTID.options[document.addUserForm.DEPTID.length] = new Option(subcat[i][1], subcat[i][0]); //导出数组,导出小类名称和小类ID
  }  
  }
   
  } 
</script>
<script language="JavaScript">  
  var onecount1;  


  onecount1=0;  
  subcat1 =new Array(); // 建立数组
<% 
int count1;
rs=stmt.executeQuery("SELECT B.DTID,B.TEAMNAME,B.DEPTID FROM EIP_DEPT A,EIP_DEPT_TEAM B,EIP_FACT C WHERE A.DID=B.DEPTID AND B.FID=C.FID ORDER BY B.DTID "); //打开数据库,这里我用的是javabean链接JDBC的方法
count1=0;
while(rs.next())

%>  
subcat1[<%=count1%>] = new Array("<%=rs.getString(1)%>","<%=rs.getString(2)%>","<%=rs.getString(3)%>"); //给数组赋值,其中rs0.getString(1)代表第1字段,这里不要搞错字段哦
<%
count1=count1+1;
}
rs.close();
%>
onecount1=<%=count1%>;
function changelocation1(id) //实现函数
  {
  document.addUserForm.TEAMID.length = 0; 
  var id=id;
  var i;//如果i从1循环那么记录中第1行的信息就看不到了
  for (i=0;i<onecount1; i++) //从数组的第1行算起 查找id ,这里的id是你大类的id(下面有我的数组例子)
  {
  if (subcat1[i][2] ==id) //第一次循环从第1行,第3列,那1列是大类ID
  { 
  document.addUserForm.TEAMID.options[document.addUserForm.TEAMID.length] = new Option(subcat1[i][1], subcat1[i][0]); //导出数组,导出小类名称和小类ID
  }  
  }
   
  } 
</script>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tbody>
  <tr>
<td width=10></td>
  <td valign=top>
<form name=addUserForm action='Admin_Mod_Users_Mod.jsp' onsubmit='return modUsers()'>
<table border=0 cellpadding=0 cellspacing=0 width='100%'>
<tr height=30>
<td>所属厂别 : </td><td><select name="FACTNO" style="width:197px;" class=textbox111 onChange="changelocation(document.addUserForm.FACTNO.options[document.addUserForm.FACTNO.selectedIndex].value);">
<option value="">--请选择--</option>
<%
rs = stmt.executeQuery("SELECT * FROM EIP_FACT ORDER BY FID");
while(rs.next()){
if(factno.equals(rs.getString("FACTNO"))){
out.print("<option value="+rs.getString("FACTNO")+" selected>"+rs.getString("FACTNAME")+"</option>");
}else{
out.print("<option value="+rs.getString("FACTNO")+">"+rs.getString("FACTNAME")+"</option>");
}
}
rs.close();
%>
</select>&nbsp;<font color=red>*</font></td>
<td>所属部门 : </td><td><select name="DEPTID" style="width:197px;" class=textbox111 onChange="changelocation1(document.addUserForm.DEPTID.options[document.addUserForm.DEPTID.selectedIndex].value);">
<option value="">--请选择--</option>
  <%
rs = stmt.executeQuery("SELECT A.DID,A.DEPTNAME,B.FACTNO FROM EIP_DEPT A,EIP_FACT B WHERE A.FID=B.FID AND B.FACTNO='"+factno+"' ORDER BY A.DID");
while(rs.next()){
if(deptid==rs.getInt("DID")){
out.print("<option value="+rs.getInt("DID")+" selected>"+rs.getString("DEPTNAME")+"</option>");
}else{
out.print("<option value="+rs.getInt("DID")+">"+rs.getString("DEPTNAME")+"</option>");
}
}
rs.close();
  %>
</select>&nbsp;<font color=red>*</font></td>
</tr>
<tr height=30>
<td>所属组别 : </td><td id=teamid>
<select name="TEAMID" style="width:197px;" class=textbox111>
  <%


rs = stmt.executeQuery("SELECT DTID,TEAMNAME FROM EIP_DEPT_TEAM WHERE DEPTID="+deptid);
while(rs.next()){
if(teamid==rs.getInt("DTID")){
out.print("<option value="+rs.getInt("DTID")+" selected>"+rs.getString("TEAMNAME")+"</option>");
}else{
out.print("<option value="+rs.getInt("DTID")+">"+rs.getString("TEAMNAME")+"</option>");
}
}
rs.close();
%>
&nbsp;<font color=red>*</font></td>
<td>联系电话 : </td><td><input type=text name=PHONE size=30 maxlength=50 class=textbox111 value="<%=phone%>"></td>
</tr>
<tr>
<td></td><td height=70 colspan=3 valign=bottom><table width="100%" border=0><tr><td id=msg height=36><img src='../Images/tips.gif'>友情提示: 红色<font color=red>* </font>号部分必须填写</td></tr><tr><td height=40><input name=sub type=submit value='更新资料'>&nbsp;&nbsp;<input name=reset type=reset value=重新填写>&nbsp;&nbsp;<input type=button name=close value=关闭窗口 onclick="javascript:window.close();"></td>
</tr>
</table></table>
</form>

</td>
  </tr>
  </tbody>
</table>
<%
}
}catch(SQLException sqlex){
out.print("Error! Error info: " + sqlex);
}catch(Exception ex){
out.print("Error! Error info: " + ex);
}finally{
if(stmt!=null) stmt.close();
if(conn!=null) conn.close();
}


%>
</body>
</HTML>

[解决办法]
两种方法:
1.通过Ajax,最好返回responseXml
在厂别onchange时
清空部门
清空组别
回调函数把部门填充

在部门onchange时
清空组别
回调函数把组别填充

2.页面初始时,将所有部门,组别全部用javascript数组存入页面
然后在厂别onchange时或部门onchange时,遍历这些数组,根据业务关系将数据找到并通过javascript操作表单元素的方法将相对的select填充。
[解决办法]
//兄弟:有例子貼出來啊!! 

[解决办法]
<html>
<head>
<title>网页特效|Linkweb.cn/Js|---全国省市县无刷新多级关联菜单</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
body,select
{
 font-size:9pt;
 font-family:Verdana;
}
a
{
 color:red;
 text-decoration:none;
}
a:hover{
 text-decoration:underline;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
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",["安徽","北京","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","天津","西藏","新疆","云南","浙江","重庆"]);



dsy.add("0_0",["安庆","蚌埠","巢湖","池州","滁州","阜阳","合肥","淮北","淮南","黄山","六安","马鞍山","宿州","铜陵","芜湖","宣城","亳州"]);
dsy.add("0_0_0",["安庆市","怀宁县","潜山县","宿松县","太湖县","桐城市","望江县","岳西县","枞阳县"]);
dsy.add("0_0_1",["蚌埠市","固镇县","怀远县","五河县"]);
dsy.add("0_0_2",["巢湖市","含山县","和县","庐江县","无为县"]);
dsy.add("0_0_3",["池州市","东至县","青阳县","石台县"]);
dsy.add("0_0_4",["滁州市","定远县","凤阳县","来安县","明光市","全椒县","天长市"]);
dsy.add("0_0_5",["阜南县","阜阳市","界首市","临泉县","太和县","颖上县"]);
dsy.add("0_0_6",["长丰县","肥东县","肥西县"]);
dsy.add("0_0_7",["淮北市","濉溪县"]);
dsy.add("0_0_8",["凤台县","淮南市"]);
dsy.add("0_0_9",["黄山市","祁门县","休宁县","歙县","黟县"]);
dsy.add("0_0_10",["霍邱县","霍山县","金寨县","六安市","寿县","舒城县"]);
dsy.add("0_0_11",["当涂县","马鞍山市"]);
dsy.add("0_0_12",["灵璧县","宿州市","萧县","泗县","砀山县"]);
dsy.add("0_0_13",["铜陵市","铜陵县"]);
dsy.add("0_0_14",["繁昌县","南陵县","芜湖市","芜湖县"]);
dsy.add("0_0_15",["广德县","绩溪县","郎溪县","宁国市","宣城市","泾县","旌德县"]);
dsy.add("0_0_16",["利辛县","蒙城县","涡阳县","亳州市"]);

dsy.add("0_1",["北京"]);
dsy.add("0_1_0",["北京市","密云县","延庆县"]);

dsy.add("0_2",["福州","龙岩","南平","宁德","莆田","泉州","三明","厦门","漳州"]);
dsy.add("0_2_0",["长乐市","福清市","福州市","连江县","罗源县","闽侯县","闽清县","平潭县","永泰县"]);
dsy.add("0_2_1",["长汀县","连城县","龙岩市","上杭县","武平县","永定县","漳平市"]);
dsy.add("0_2_2",["光泽县","建阳市","建瓯市","南平市","浦城县","邵武市","顺昌县","松溪县","武夷山市","政和县"]);
dsy.add("0_2_3",["福安市","福鼎市","古田县","宁德市","屏南县","寿宁县","霞浦县","周宁县","柘荣县"]);
dsy.add("0_2_4",["莆田市","仙游县"]);
dsy.add("0_2_5",["安溪县","德化县","惠安县","金门县","晋江市","南安市","泉州市","石狮市","永春县"]);
dsy.add("0_2_6",["大田县","建宁县","将乐县","明溪县","宁化县","清流县","三明市","沙县","泰宁县","永安市","尤溪县"]);
dsy.add("0_2_7",["厦门市"]);
dsy.add("0_2_8",["长泰县","东山县","华安县","龙海市","南靖县","平和县","云霄县","漳浦县","漳州市","诏安县"]);

dsy.add("0_3",["白银","定西","甘南藏族自治州","嘉峪关","金昌","酒泉","兰州","临夏回族自治州","陇南","平凉","庆阳","天水","武威","张掖"]);


dsy.add("0_3_0",["白银市","会宁县","景泰县","靖远县"]);
dsy.add("0_3_1",["定西县","临洮县","陇西县","通渭县","渭源县","漳县","岷县"]);
dsy.add("0_3_2",["迭部县","合作市","临潭县","碌曲县","玛曲县","夏河县","舟曲县","卓尼县"]);
dsy.add("0_3_3",["嘉峪关市"]);
dsy.add("0_3_4",["金昌市","永昌县"]);
dsy.add("0_3_5",["阿克塞哈萨克族自治县","安西县","敦煌市","金塔县","酒泉市","肃北蒙古族自治县","玉门市"]);
dsy.add("0_3_6",["皋兰县","兰州市","永登县","榆中县"]);
dsy.add("0_3_7",["东乡族自治县","广河县","和政县","积石山保安族东乡族撒拉族自治县","康乐县","临夏市","临夏县","永靖县"]);
dsy.add("0_3_8",["成县","徽县","康县","礼县","两当县","文县","武都县","西和县","宕昌县"]);
dsy.add("0_3_9",["崇信县","华亭县","静宁县","灵台县","平凉市","庄浪县","泾川县"]);
dsy.add("0_3_10",["合水县","华池县","环县","宁县","庆城县","庆阳市","镇原县","正宁县"]);
dsy.add("0_3_11",["甘谷县","秦安县","清水县","天水市","武山县","张家川回族自治县"]);
dsy.add("0_3_12",["古浪县","民勤县","天祝藏族自治县","武威市"]);
dsy.add("0_3_13",["高台县","临泽县","民乐县","山丹县","肃南裕固族自治县","张掖市"]);

dsy.add("0_4",["潮州","东莞","佛山","广州","河源","惠州","江门","揭阳","茂名","梅州","清远","汕头","汕尾","韶关","深圳","阳江","云浮","湛江","肇庆","中山","珠海"]);
dsy.add("0_4_0",["潮安县","潮州市","饶平县"]);
dsy.add("0_4_1",["东莞市"]);
dsy.add("0_4_2",["佛山市"]);
dsy.add("0_4_3",["从化市","广州市","增城市"]);
dsy.add("0_4_4",["东源县","和平县","河源市","连平县","龙川县","紫金县"]);
dsy.add("0_4_5",["博罗县","惠东县","惠阳市","惠州市","龙门县"]);
dsy.add("0_4_6",["恩平市","鹤山市","江门市","开平市","台山市"]);
dsy.add("0_4_7",["惠来县","揭东县","揭西县","揭阳市","普宁市"]);
dsy.add("0_4_8",["电白县","高州市","化州市","茂名市","信宜市"]);
dsy.add("0_4_9",["大埔县","丰顺县","蕉岭县","梅县","梅州市","平远县","五华县","兴宁市"]);
dsy.add("0_4_10",["佛冈县","连南瑶族自治县","连山壮族瑶族自治县","连州市","清新县","清远市","阳山县","英德市"]);
dsy.add("0_4_11",["潮阳市","澄海市","南澳县","汕头市"]);
dsy.add("0_4_12",["海丰县","陆丰市","陆河县","汕尾市"]);
dsy.add("0_4_13",["乐昌市","南雄市","曲江县","仁化县","乳源瑶族自治县","韶关市","始兴县","翁源县","新丰县"]);
dsy.add("0_4_14",["深圳市"]);
dsy.add("0_4_15",["阳春市","阳东县","阳江市","阳西县"]);
dsy.add("0_4_16",["罗定市","新兴县","郁南县","云安县","云浮市"]);
dsy.add("0_4_17",["雷州市","廉江市","遂溪县","吴川市","徐闻县","湛江市"]);


dsy.add("0_4_18",["德庆县","封开县","高要市","广宁县","怀集县","四会市","肇庆市"]);
dsy.add("0_4_19",["中山市"]);
dsy.add("0_4_20",["珠海市"]);

dsy.add("0_5",["百色","北海","崇左","防城港","桂林","贵港","河池","贺州","来宾","柳州","南宁","钦州","梧州","玉林"]);
dsy.add("0_5_0",["百色市","德保县","靖西县","乐业县","凌云县","隆林各族自治县","那坡县","平果县","田东县","田林县","田阳县","西林县"]);
dsy.add("0_5_1",["北海市","合浦县"]);
dsy.add("0_5_2",["崇左市","大新县","扶绥县","龙州县","宁明县","凭祥市","天等县"]);
dsy.add("0_5_3",["东兴市","防城港市","上思县"]);
dsy.add("0_5_4",["恭城瑶族自治县","灌阳县","桂林市","荔浦县","临桂县","灵川县","龙胜各族自治县","平乐县","全州县","兴安县","阳朔县","永福县","资源县"]);
dsy.add("0_5_5",["桂平市","贵港市","平南县"]);
dsy.add("0_5_6",["巴马瑶族自治县","大化瑶族自治县","东兰县","都安瑶族自治县","凤山县","河池市","环江毛南族自治县","罗城仡佬族自治县","南丹县","天峨县","宜州市"]);
dsy.add("0_5_7",["富川瑶族自治县","贺州市","昭平县","钟山县"]);
dsy.add("0_5_8",["合山市","金秀瑶族自治县","来宾市","武宣县","象州县","忻城县"]);
dsy.add("0_5_9",["柳城县","柳江县","柳州市","鹿寨县","融安县","融水苗族自治县","三江侗族自治县"]);
dsy.add("0_5_10",["宾阳县","横县","隆安县","马山县","南宁市","上林县","武鸣县","邕宁县"]);
dsy.add("0_5_11",["灵山县","浦北县","钦州市"]);
dsy.add("0_5_12",["苍梧县","蒙山县","藤县","梧州市","岑溪市"]);
dsy.add("0_5_13",["北流市","博白县","陆川县","容县","兴业县","玉林市"]);
dsy.add("0_6",["安顺","毕节","贵阳","六盘水","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","铜仁","遵义"]);
dsy.add("0_6_0",["安顺市","关岭布依族苗族自治县","平坝县","普定县","镇宁布依族苗族自治县","紫云苗族布依族自治县"]);
dsy.add("0_6_1",["毕节市","大方县","赫章县","金沙县","纳雍县","黔西县","威宁彝族回族苗族自治县","织金县"]);
dsy.add("0_6_2",["贵阳市","开阳县","清镇市","息烽县","修文县"]);
dsy.add("0_6_3",["六盘水市","六枝特区","盘县","水城县"]);
dsy.add("0_6_4",["从江县","丹寨县","黄平县","剑河县","锦屏县","凯里市","雷山县","黎平县","麻江县","三穗县","施秉县","台江县","天柱县","镇远县","岑巩县","榕江县"]);
dsy.add("0_6_5",["长顺县","都匀市","独山县","福泉市","贵定县","惠水县","荔波县","龙里县","罗甸县","平塘县","三都水族自治县","瓮安县"]);
dsy.add("0_6_6",["安龙县","册亨县","普安县","晴隆县","望谟县","兴仁县","兴义市","贞丰县"]);
dsy.add("0_6_7",["德江县","江口县","石阡县","思南县","松桃苗族自治县","铜仁市","万山特区","沿河土家族自治县","印江土家族苗族自治县","玉屏侗族自治县"]);


dsy.add("0_6_8",["赤水市","道真仡佬族苗族自治县","凤冈县","仁怀市","绥阳县","桐梓县","务川仡佬族苗族自治县","习水县","余庆县","正安县","遵义市","遵义县","湄潭县"]);


dsy.add("0_30",["重庆"]);
dsy.add("0_30_0",["城口县","大足县","垫江县","丰都县","奉节县","合川市","江津市","开县","梁平县","南川市","彭水苗族土家族自治县","荣昌县","石柱土家族自治县","铜梁县","巫山县","巫溪县","武隆县","秀山土家族苗族自治县","永川市","酉阳土家族苗族自治县","云阳县","忠县","重庆市","潼南县","璧山县","綦江县"]);
//-->
</SCRIPT>
<SCRIPT LANGUAGE = JavaScript>
<!--
//** Power by Fason(2004-3-11)
//** Email:fason_pfx@hotmail.com

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"><option>省份</option></select>
<select id="s2"><option>地级市</option></select>
<select id="s3"><option>市、县级市、县</option></select>
</form>

</body>
</html>
[解决办法]
太多了看了晕汗
[解决办法]
<!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> 
<script> 
function change(){ 
var xzqhid=document.all.address.options

[document.all.address.selectedIndex].value; 
var user=document.all.user; 
var tel=document.all.tel; 
var userAll=document.all.userAll; 
var telAll=document.all.telAll; 

for(i=user.options.length-1;i>=0;i--)
{
user.options.remove(i);
}

for(i=tel.options.length-1;i>=0;i--)
{
tel.options.remove(i);
}
  
if(parseInt(xzqhid)==0){ 
return; 

user.add(new Option("---选择人员---",0)); 
for(var i=0;i <userAll.options.length;i++) 

if(userAll.options[i].addressid==xzqhid) 

user.add(new Option(userAll.options[i].text,userAll.options

[i].value)); 
}


  
function changeUser(){ 
var userid=document.all.user.options

[document.all.user.selectedIndex].value; 
var tel=document.all.tel; 
var telAll=document.all.telAll; 

for(i=tel.options.length-1;i>=0;i--)
{
tel.options.remove(i);

if(parseInt(userid)==0){ 
return; 

for(var i=0;i <telAll.options.length;i++) 

if(telAll.options[i].userid==userid) 

tel.add(new Option(telAll.options[i].text,telAll.options[i].value)); 


}



</script> 
</head> 

<body> 
<form id="form1" name="form1" method="post" action=""> 
<label> 
<select name="address" onchange="change()"> 
<option value="0">---选择地区--- </option> 
<option value="1">北京 </option> 
<option value="2">上海 </option> 
<option value="3">深圳 </option> 
<option value="4">广州 </option> 
</select> 
</label> 
<label> 
<select name="user" onchange="changeUser()"> 
</select> 
</label> 
<label> 
<select name="tel"> 
</select> 
</label> 
<label> 
<!--数据库里面读取的信息,加一个属性--> 
<select name="userAll" style="display:none"> 
<option value="1" addressid='1'>aaaaaaaa </option> 
<option value="2" addressid='1'>bbbbbbbbbb </option> 
<option value="3" addressid='2'>cccccc </option> 
<option value="4" addressid='2'>dddddddddd </option> 
<option value="5" addressid='3'>eeeeeeeeee </option> 
<option value="6" addressid='3'>wwwwwwwwww </option> 
<option value="7" addressid='4'>sssssssss </option> 
<option value="8" addressid='4'>ffff </option> 
<option value="9" addressid='3'>hhhh </option> 
<option value="10" addressid='4'>ttttt </option> 
</select> 
</label> 
<label> 
<!--数据库里面读取的信息,加一个属性--> 
<select name="telAll" style="display:none"> 
<option value="1302102302" userid='1'>1302102301a </option> 
<option value="1302102302" userid='2'>1302102302b </option> 
<option value="1302102302" userid='3'>1302102303c </option> 
<option value="1302102302" userid='1'>1302102301a </option> 
<option value="1302102302" userid='2'>1302102302b </option> 
<option value="1302102302" userid='3'>1302102303c </option> 
<option value="1302102302" userid='4'>1302102304d </option> 
<option value="1302102302" userid='5'>1302102305e </option> 
<option value="1302102302" userid='6'>1302102306w </option> 
<option value="1302102302" userid='7'>1302102307s </option> 
<option value="1302102302" userid='8'>1302102308f </option> 
</select> 
</label> 
</form> 
</body> 
</html>
[解决办法]
levelOneChange()
{
...........
levelTwoChangge(id);
}
levelTowChange(id)
{
..........
levelThreeChange(id);
}
levelThreeChange(id)
{

}
[解决办法]
学习学习 ··
[解决办法]
确实很好的东西,值得学习

热点排行