| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 299 人关注过本帖
标题:这段代码错在哪里啊?
只看楼主 加入收藏
skybirdzw
Rank: 2
等 级:论坛游民
帖 子:189
专家分:12
注 册:2007-3-30
结帖率:66.67%
收藏
 问题点数:0 回复次数:2 
这段代码错在哪里啊?
放在一个单独的文件里测试没有任何问题,为什么一旦放在一个完整的页面里却出错,小类里的项目都跑到大类里了!
而且下面的代码也出错了。。。 郁闷啊~ 大家帮我看看是怎么回事?

<select name="s1" onChange="redirec(document.form2.s1.options.selectedIndex)">
  <option value="请选择" selected>岗位类别大类</option>
   <%
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from classification order by position_id desc"
rs.open sql,conn,1,1
while not rs.eof%>
        <option value="<%=rs("position_id")%>"><%=rs("position_name")%></option>
  <%rs.movenext
  wend
rs.close
set rs=nothing
%>
</select>

<select name="s2">
<option value="请选择" selected>岗位类别小类</option>
</select>
<script language="javascript">
//获取一级菜单长度
var select1_len = document.form2.s1.options.length;
var select2 = new Array(select1_len);
//把一级菜单都设为数组
for (i=0; i<select1_len; i++)
{ select2[i] = new Array();}
//定义基本选项
select2[0][0] = new Option("请选择", " ");

select2[1][0] = new Option("轮机长", " ");
select2[1][1] = new Option("大管", " ");
select2[1][2] = new Option("二管", " ");
select2[1][3] = new Option("三管", " ");
select2[1][4] = new Option("加油", " ");
select2[1][5] = new Option("机头", " ");
select2[1][6] = new Option("机工", " ");
select2[1][7] = new Option("轮机实习生", " ");
select2[1][8] = new Option("铜匠", " ");
select2[1][9] = new Option("电机员", " ");  


select2[2][0] = new Option("甲板实习生", " ");
select2[2][1] = new Option("水头", " ");
select2[2][2] = new Option("一水", " ");
select2[2][3] = new Option("二水", " ");
select2[2][4] = new Option("船长", " ");
select2[2][5] = new Option("大副", " ");
select2[2][6] = new Option("二副", " ");
select2[2][7] = new Option("三副", " ");
select2[2][8] = new Option("木匠", " ");
select2[2][9] = new Option("报务员", " ");

select2[3][0] = new Option("大厨", " ");
select2[3][1] = new Option("管事", " ");
select2[3][2] = new Option("二厨", " ");
select2[3][3] = new Option("服务生", " ");
//联动函数
function redirec(x)
{
var temp = document.form2.s2;
for (i=0;i<select2[x].length;i++)
{ temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);}
temp.options[0].selected=true;
}
</script>


-----------------------------------------------------------------
<select name="s11" onChange="redirec1(document.form2.s11.options.selectedIndex)">
  <option value="请选择" selected>航线区域大类</option>
   <%
set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from sail order by fid desc"
rs.open sql,conn,1,1
while not rs.eof%>
        <option value="<%=rs("fid")%>"><%=rs("sail")%></option>
  <%rs.movenext
  wend
rs.close
set rs=nothing
%>
</select>

<select name="s21">
<option value="请选择" selected>航线区域小类</option>
</select>

<script language="javascript">
//获取一级菜单长度
var select1_len1 = document.form2.s11.options.length;
var select21 = new Array(select1_len1);
//把一级菜单都设为数组
for (i=0; i<select1_len1; i++)
{ select21[i] = new Array();}
//定义基本选项
select21[0][0] = new Option("请选择", " ");

select21[1][0] = new Option("东南亚", " ");
select21[1][1] = new Option("北美", " ");
select21[1][2] = new Option("南美", " ");
select21[1][3] = new Option("欧洲", " ");
select21[1][4] = new Option("印度洋", " ");
select21[1][5] = new Option("其他远洋", " ");


select21[2][0] = new Option("南北航线", " ");
select21[2][1] = new Option("江海航线", " ");
select21[2][2] = new Option("其他航线", " ");


//联动函数
function redirec1(x)
{
var temp1 = document.form2.s21;
for (i=0;i<select21[x].length;i++)
{ temp1.options[i]=new Option(select21[x][i].text,select21[x][i].value);}
temp1.options[0].selected=true;
}
</script>

不好意思,水平有限~~~在此先谢过。
搜索更多相关主题的帖子: 代码 
2008-05-20 18:10
multiple1902
Rank: 8Rank: 8
等 级:贵宾
威 望:42
帖 子:4881
专家分:671
注 册:2007-2-9
收藏
得分:0 
这里不是asp论坛么?
2008-05-20 21:37
skybirdzw
Rank: 2
等 级:论坛游民
帖 子:189
专家分:12
注 册:2007-3-30
收藏
得分:0 
......
2008-05-21 08:04
快速回复:这段代码错在哪里啊?
数据加载中...
 
   



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

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