[求助]关于在我机子可以运行的三级菜单,拷到其他的机子就运行不了了。
<%@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> </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"> 份</font></div></td>
<td width="25%"><div align="center"><font size="2">地 州</font></div></td>
<td width="25%"><div align="center"><font size="2">县 (市)</font></div></td>
<td width="12%"><div align="center"><font size="2">通讯员</font></div></td>
<td colspan="2"><div align="center"><font size="2">操 作</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">
以下为添加地区信息部分 (带<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"> </td>
</tr>
<tr>
<td height="43" colspan="2"> <div align="center">
<input type=submit value=完成录入 name=Submit>
<input type=reset value=清空重写 name=Submit_a>
</div></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td> </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编辑过]