| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 622 人关注过本帖
标题:[求助]关于在我机子可以运行的三级菜单,拷到其他的机子就运行不了了。
只看楼主 加入收藏
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
结帖率:68.57%
收藏
 问题点数:0 回复次数:8 
[求助]关于在我机子可以运行的三级菜单,拷到其他的机子就运行不了了。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file = "checkinfoadmin.asp"--> <!-- #include file="conn.asp" --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>:::通讯员信息输入:::</title> <link href="../css/fontsize.css" rel="stylesheet" type="text/css"> <link href="../css/input_form.css" rel="stylesheet" type="text/css"> <link href="../css/inputform1.css" rel="stylesheet" type="text/css"> <link href="../css/selectform.css" rel="stylesheet" type="text/css"> <link href="../css/inputform2.css" rel="stylesheet" type="text/css"> <link href="../css/inputform3.css" rel="stylesheet" type="text/css"> <link href="../css/inputform3.css" rel="stylesheet" type="text/css"> <link href="../css/link.css" rel="stylesheet" type="text/css"> <link href="../css/buttoncss.css" rel="stylesheet" type="text/css"> <link href="../css/inputchaxun.css" rel="stylesheet" type="text/css"> <link href="../css/city.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- body { background-image: url(../pictures/beij.jpg); } .style2 {font-size: 2} --> </style></head> <body bgcolor="#6699cc" > <p> <% '--------------------------删除单条记录 if request("method")="del" then id=request("id") sql = "DELETE FROM tongxunyuan WHERE id=" + cstr(id) conn.execute sql response.Write "<script >" response.Write("alert('删除操作成功!');") response.Write("window.navigate('tongxunyuan.asp')") response.Write("</script>") %> <% end if %> </p> <p>&nbsp;</p> <table width="73%" border="0" align="center" cellpadding="0" cellspacing="0" area="fontsize"> <tr> <td width="100%" height="71"> <table width="680" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" area="fontsize" style="border-collapse: collapse"> <form name="chaxun_form" action="tongxunyuan.asp" method="post"> <tr align="center" valign="middle"> <td width="10%" height="23" > <div align="center"><font size="2">省份</font></div></td> <td width="20%"> <div align="center"><font size="2"> <select name="province_chaxun" area="selectformat" id="province_chaxun" onMouseOver="this.focus();" onChange="make_city_menu(this.value,document.chaxun_form.city_chaxun)"> <option value="" selected>--省份信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from province order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("province")%>" ><%=rs("province")%></option> <% rs.movenext loop end if %> </select> </font></div></td> <td width="10%"><div align="center"><font size="2">地区</font></div></td> <td width="22%"><div align="center"><font size="2"> <select name="city_chaxun" area="selectformat" id="city_chaxun" onMouseOver="this.focus();" onChange="make_area_menu(this.value,document.chaxun_form.area_chaxun)"> <option value="" selected>--地区信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from city order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("city")%>" ><%=rs("city")%></option> <% rs.movenext loop end if %> </select> </font></div></td> <td width="11%"><font size="2">县-市</font></td> <td width="15%"><font size="2"> <select name=area_chaxun class="selectformat" id="select19" onmouseover="this.focus();" > <option selected>--县市信息--</option> </select> </font></td> <td width="18%"><font size="2">通讯员</font></td> <td width="15%"><font size="2"> <input name="txy_chaxun" type="text" id="txy_chaxun" onMouseOver="this.focus();" size="6" area="bottoncity"> </font></td> <td width="15%"> <font size="2"> <input name="chaxun" type="submit" area="buttoncss" id="chaxun" value="我要查询"></font></td> </tr> </form> </table></td> </tr> <tr> </td> </tr> <tr> <td> <table width="680" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse"> <tr area="fontsize"> <td width="12%" height="30"> <div align="center"><font size="2">省</font><font size="2">&nbsp;&nbsp;份</font></div></td> <td width="25%"><div align="center"><font size="2">地&nbsp;&nbsp;州</font></div></td> <td width="25%"><div align="center"><font size="2">县&nbsp;(市)</font></div></td> <td width="12%"><div align="center"><font size="2">通讯员</font></div></td> <td colspan="2"><div align="center"><font size="2">操&nbsp;&nbsp;作</font></div></td> </tr> <% set rs=server.CreateObject("adodb.recordset") sql= "select * from tongxunyuan where province like '%"&trim(request("province_chaxun"))&"%' and city like '%"&trim(request("city_chaxun"))&"%' and area like '%"&trim(request("area_chaxun"))&"%'and txy like '%"&trim(request("txy_chaxun"))&"%'" rs.open sql,conn,1,1 if rs.recordcount <> 0 then rs.movefirst do while not rs.eof %> <tr area="fontsize"> <td height="28"><div align="center"><font size="2"><%=rs("province")%></font></div></td> <td><div align="center"><font size="2"><%=rs("city")%></font></div></td> <td><div align="center"><font size="2"><%=rs("area")%></font></div></td> <td><div align="center"><font size="2"><%=rs("txy")%></font></div></td> <td width="9%"> <div align="center"> <font size="2"> <% response.Write("<a href='javascript:SureDelSingle(" & cstr(rs("id")) & ")'>删除</a>") %> </font></div></td> <td width="9%"><div align="center"><font size="2"><a href="modify_tongxunyuan.asp?id=<%=rs("id")%>">修改</a> </font></div></td> </tr> <% rs.movenext loop else %> <tr area="fontsize"> <td height="24" colspan="6"> <div align="center"><font color="#FF0000" size="2">对不起,没有通讯员信息!</font></div></td> </tr> <% end if %> </table> <form name="input_form" action="add_tongxunyuan.asp" method="post" onSubmit="return checkform();"> <table width="680" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" style="border-collapse: collapse"> <tr> <td height="24" colspan="2"><div align="left"><font size="2">&nbsp; &nbsp;&nbsp; 以下为添加地区信息部分 (带<font color="#FF0000">*<font color="#000000">为必填项</font></font>):</font> </div></td> </tr> <tr> <td width="323" height="24"> <div align="right"> <table width="139" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">省份:</font> </td> </tr> </table> </div></td> <td width="368"> <div align="left"> <font size="2"> <select name="province" area="selectformat" id="province" onMouseOver="this.focus();" onChange="make_city_menu(this.value,document.input_form.city)"> <option value="" selected>--省份信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from province order by id desc " rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("province")%>" ><%=rs("province")%></option> <% rs.movenext loop end if %> </select> </font><font color="#FF0000">*</font><font size="2"> </font></div></td> </tr> <tr> <td> <div align="right"> <table width="139" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="83" height="15"><font size="2">地州:</font> </td> </tr> </table> </div></td> <td> <div align="left"> <font size="2"> <select name="city" area="selectformat" id="city" onMouseOver="this.focus();" onChange="make_area_menu(this.value,document.input_form.area)"> <option value="" selected>--地区信息--</option> <% set rs=server.CreateObject("adodb.recordset") sql="select * from city order by id desc" rs.open sql,conn ,1,1 if rs.recordcount<>0 then do while not rs.eof %> <option value="<%=rs("city")%>" ><%=rs("city")%></option> <% rs.movenext loop end if %> </select> </font><font color="#FF0000">*</font></div></td> </tr> <tr> <td> <div align="right"> <table width="139" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">县(市):</font></td> </tr> </table> </div></td> <td> <div align="left"> <font size="2"> <select name=area class="selectformat" id="select19" onmouseover="this.focus();" > <option selected>--县市信息--</option> </select> </font><font color="#FF0000">*</font></div></td> </tr> <tr> <td><div align="right"> <table width="139" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td width="112" height="15"><font size="2">通讯员:</font></td> </tr> </table> </div></td> <td><div align="left"> <font size="2"> <input name="get_txy" type="text" id="get_txy" onMouseOver="this.focus();" size="13.5" txy="inputform1"> </font><font color="#FF0000"> *</font></div></td> </tr> <tr> <td height="20" colspan="2">&nbsp;</td> </tr> <tr> <td height="43" colspan="2"> <div align="center"> <input type=submit value=完成录入 name=Submit> &nbsp; <input type=reset value=清空重写 name=Submit_a> </div></td> </tr> </table> </form></td> </tr> <tr> <td>&nbsp;</td> </tr> </table> <% rs.close set rs = nothing conn.close set conn = nothing %> </body> <script language="JavaScript" > function make_city_menu(province_value,city_X) { var sql = "select * from city where province='"+province_value+"'" ; var ConnDB = new ActiveXObject("adodb.connection"); var rs = new ActiveXObject("ADODB.Recordset"); ConnDB.ConnectionString="DSN=data;uid=data;pwd=data"; ConnDB.open rs.open(sql,ConnDB,1,1); if(rs.recordcount!=0) { var count=1; city_X.options[0]=new Option("--地区信息--",""); while(!rs.eof) { city_X.options[count]=new Option(rs("city"),rs("city")); count=count+1; rs.movenext } var sql=null; rs.close ConnDB.close city_X.options[0].selected=true; city_X.length=count; } else { city_X.options[0]=new Option("--地区信息--",""); var sql=null; rs.close ConnDB.close city_X.options[0].selected=true; city_X.length=1; } } function make_area_menu(city_value,area_X) { var sql = "select * from area where city='"+city_value+"'" ; var ConnDB = new ActiveXObject("adodb.connection"); var rs = new ActiveXObject("ADODB.Recordset"); ConnDB.ConnectionString="DSN=data;uid=data;pwd=data"; ConnDB.open rs.open(sql,ConnDB,1,1); if(rs.recordcount!=0) { var count=1; area_X.options[0]=new Option("--县市信息--",""); while(!rs.eof) { area_X.options[count]=new Option(rs("area"),rs("area")); count=count+1; rs.movenext } var sql=null; rs.close ConnDB.close area_X.options[0].selected=true; area_X.length=count; } else { area_X.options[0]=new Option("--县市信息--",""); var sql=null; rs.close ConnDB.close area_X.options[0].selected=true; area_X.length=1; } } function checkform() { var subst = document. input_form; if (subst.province.value=="") { alert("省份信息不能为空!"); subst.province.focus(); return false; } if (subst.city.value=="") { alert(" 地州市信息不能为空!"); subst.city.focus(); return false; } if (subst.area.value=="") { alert(" 县(市)信息不能为空!"); subst.area.focus(); return false; } if (subst.get_txy.value=="") { alert("通讯员信息不能为空!"); subst.get_txy.focus(); return false; } return true; } function SureDelSingle(id) { if ( confirm("您确定要删除该通讯员信息吗?")) { window.location.href = "tongxunyuan.asp?method=del&id=" +id; } } </script> </html>
以上一段代码是实现三级菜单的功能:比如 贵州省(省)——>遵义地区(地区)——>遵义县(县) ,我虽然花了很长时间弄出来了,在我机子上运行是根本没有问题的。得到了我想要的结果,但是我把整个系统拷到其他地方的计算机上安装运行的时候,有三级菜单的地方都得出了问题。显示了一级菜单的内容,二级菜单显示的是我输入所有的地区,包括贵州以外的那些地区也显示出来了,显然达不到联级菜单的功能。三级的更不可思议,显示都显示不出来了(不管选哪一个地区),我思考很长时间了,不晓得为什么!大家有没有什么经验和办法呀!帮个忙,这对我来说太重要了,谢谢为先!!

[此贴子已经被作者于2005-8-19 12:53:36编辑过]

搜索更多相关主题的帖子: 菜单 运行 
2005-08-19 12:47
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
是不是他的机器上面禁止了脚本了?

2005-08-19 14:21
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
楼主把我的改改能用不 [URL=http://www.]点击察看演示[/URL]

以下是源代码
&lt;%Set Conn=Server.CreateObject("ADODB.Connection")
Connstr="DBQ="+server.mappath("db3.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)}"
Conn.Open connstr
set rs=server.CreateObject("adodb.recordset")
sql="select sortsid,sorts,categoryid from sorts"'二级字段:id 名称 所属上级id
rs.open sql,conn,1,1%&gt;
&lt;script language="JavaScript"&gt;
function bb(num){
city = new Array();
&lt;%do while not rs.eof
i=i+1%&gt;
city[&lt;%=i%&gt;]= new Array("&lt;%=rs(1)%&gt;","&lt;%=rs(0)%&gt;","&lt;%=rs(2)%&gt;");
&lt;%rs.movenext
loop
rs.close
sql="select sanid,san,sortsid from san"
rs.open sql,conn,1,1%&gt;//读出三级数据 字段:id 名称 所属上级id
//把数组的值用数据库读出
 document.form1.s1.length = 0;
 document.form1.s2.length = 0;
 document.form1.s2.options[0]= new Option("请选择小类","0");
 document.form1.s1.length = 0;
 document.form1.s1.options[0]= new Option("清选择中类","0");
j=1;
for(i=1;i&lt;=&lt;%=i%&gt;;i++)
{ if(city[i][2]==num)
 {document.form1.s1.options[document.form1.s1.length]= new Option(city[i][0],city[i][1]);}
 j++}
}
function cc(num){
city = new Array();
//写入三级
&lt;%i=0
do while not rs.eof
i=i+1%&gt;
city[&lt;%=i%&gt;]= new Array("&lt;%=rs(1)%&gt;","&lt;%=rs(0)%&gt;","&lt;%=rs(2)%&gt;");
&lt;%rs.movenext
loop
rs.close%&gt;
//把数组的值从数据库读出
 document.form1.s2.length = 0;
 document.form1.s2.options[0]= new Option("清选择小类","0");
j=1;
for(i=1;i&lt;=&lt;%=i%&gt;;i++)
{ if(city[i][2]==num)
 {document.form1.s2.options[document.form1.s2.length]= new Option(city[i][0],city[i][1]);}
 j++}
}
&lt;/script&gt;
&lt;body&gt;
&lt;center&gt;
&lt;form name="form1" method="post" action=""&gt;
&lt;!--form1.ss的值用数据库读出--&gt;
  &lt;select name="ss" onChange="bb(document.form1.ss.options[document.form1.ss.selectedIndex].value)"&gt;
   &lt;option value="0"&gt;清选择大类&lt;/option&gt;
&lt;%sql="select categoryid,category from category"
rs.open sql,conn,1,1
do while not rs.eof%&gt;
 &lt;option value="&lt;%=rs(0)%&gt;"&gt;&lt;%=rs(1)%&gt;&lt;/option&gt;
&lt;%rs.movenext
loop
rs.close%&gt;
  &lt;/select&gt;
  &lt;select name="s1" onChange="cc(document.form1.s1.options[document.form1.s1.selectedIndex].value)"&gt;
  &lt;option value="0"&gt;请选择中类&lt;/option&gt;
  &lt;/select&gt;
  &lt;select name="s2" id="s2"&gt;
  &lt;option value="0"&gt;请选择小类&lt;/option&gt;
  &lt;/select&gt;
  &lt;br&gt;
  测试成功!(只有住宅--&amp;gt;联邦中都、上城有小类数据 )
&lt;/form&gt;
&lt;/center&gt;
&lt;/body&gt;
2005-08-19 14:49
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
请问:如是禁止了脚本,那怎么处理呢!


谢谢你们的回复,

islet   经典的代码,我会好好参考!谢谢!

我是农家的孩子,我有农家孩子的本色!
2005-08-19 14:58
hxfly
Rank: 5Rank: 5
等 级:贵宾
威 望:17
帖 子:5810
专家分:118
注 册:2005-4-7
收藏
得分:0 
IE
工具
INTERNET选项
安全


选择相应的

[此贴子已经被作者于2005-8-19 15:50:24编辑过]



2005-08-19 15:49
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
收藏
得分:0 
IE属性设置...
啊..

面朝大海,春暖花开!
2005-08-19 16:03
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
我试一下

谢谢!

我是农家的孩子,我有农家孩子的本色!
2005-08-19 19:29
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
不行!只不过非常谢谢您!

我是农家的孩子,我有农家孩子的本色!
2005-08-20 14:54
anjincheng
Rank: 2
等 级:论坛游民
威 望:5
帖 子:728
专家分:31
注 册:2005-7-27
收藏
得分:0 
各老师们还有没有其它好的建议呢!谢谢!

我是农家的孩子,我有农家孩子的本色!
2005-08-20 19:12
快速回复:[求助]关于在我机子可以运行的三级菜单,拷到其他的机子就运行不了了。 ...
数据加载中...
 
   



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

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