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

asp页面中,点击select“省”一栏,“市”没有发生改变,求解!该如何处理

2012-02-02 
asp页面中,点击select“省”一栏,“市”没有发生改变,求解!!!%dim count33set rs33server.createobject(ado

asp页面中,点击select“省”一栏,“市”没有发生改变,求解!!!
<%
dim count33
set rs33=server.createobject("adodb.recordset")
rs33.open "select * from area ",conn,1,1
%>
<script language = "JavaScript">
var onecount33;
onecount33=0;
subcat33 = new Array();

<%
  count33 = 0
  do while not rs33.eof 
%>
subcat33[<%=count33%>] = new Array("<%= trim(rs33("title"))%>","<%= rs33("fl")%>","<%= rs33("id")%>");

<%
  count33 = count33 + 1
  rs33.movenext
  loop
  rs33.close
%>

onecount33=<%=count33%>;


function changelocation3(locationid)
  {
alert('输出');
  document.myform.shi.length = 0; 

  var locationid=locationid;
  var i;
  for (i=0;i < onecount33; i++)
  {
  if (subcat33[i][1] == locationid)
  { //这句不是很理解
  document.myform.shi.options[document.myform.shi.length] = new Option(subcat33[i][0], subcat33[i][2]);
  }  
  }
   
  }
function changelocation4(locationid)
  {
  document.myform.qu.length = 0; 

  var locationid=locationid;
  var i;
  for (i=0;i < onecount33; i++)
  {
  if (subcat33[i][1] == locationid)
  { //这句不是很理解
  document.myform.qu.options[document.myform.qu.length] = new Option(subcat33[i][0], subcat33[i][2]);
  }  
  }
   
  }  

  
</script>


<%
dim count4
set rs4=server.createobject("adodb.recordset")
rs4.open "select * from area ",conn,1,1
%>
<script language = "JavaScript">
var onecount4;
onecount4=0;
subcat4 = new Array();

<%
  count4 = 0
  do while not rs4.eof 
%>
subcat4[<%=count4%>] = new Array("<%= trim(rs4("title"))%>","<%= rs4("fl")%>","<%= rs4("id")%>");

<%
  count4 = count4 + 1
  rs4.movenext
  loop
  rs4.close
%>

onecount4=<%=count4%>;

 
function changelocation4(locationid)
  {
  document.myform.qu.length = 0; 

  var locationid=locationid;
  var i;
  for (i=0;i < onecount4; i++)
  {
  if (subcat4[i][1] == locationid)
  { //这句不是很理解
  document.myform.qu.options[document.myform.qu.length] = new Option(subcat4[i][0], subcat4[i][2]);
  }  
  }
   
  }  
</script>




  省份:
  <select name="sheng" size="1" id="sheng" onChange="changelocation3(document.myform.sheng.options[document.myform.sheng.selectedIndex].value)">
  <option value="<%=rs("id")%>" selected><%=trim(rs("title"))%></option>
  <%  
dim ss
  ss=rs("id")
  rs.movenext
  do while not rs.eof
%>
  <option value="<%=rs("id")%>"><%=trim(rs("title"))%></option>


  <%
  rs.movenext
  loop
end if
  rs.close
%>
  </select>
   
  &nbsp;市: 
  <select name="shi" id="shi" size="1" onChange="changelocation4(document.myform.shi.options[document.myform.shi.selectedIndex].value)" >
  <%rs.open "select * from area where fl="&ss ,conn,1,1
 
if not(rs.eof and rs.bof) then
%>
  <option selected value="<%=rs("id")%>"><%=rs("title")%></option>
  <%
dim ss2
  ss2=rs("id")
rs.movenext
do while not rs.eof%>
  <option value="<%=rs("id")%>"><%=rs("title")%></option>
  <% rs.movenext
loop
end if
  rs.close

%>
  </select>
   
  &nbsp;区(镇): 
  <select name="qu" id="qu" datatype="Require">
<%
rs.open "select * from area where fl="&ss2,conn,1,1
  if not(rs.eof and rs.bof) then
%>
  <option selected value="<%=rs("id")%>"><%=rs("title")%></option>
  <% rs.movenext
do while not rs.eof%>
  <option value="<%=rs("id")%>"><%=rs("title")%></option>
  <% rs.movenext
loop
end if
  rs.close
  set rs = nothing
%>
  </select>
   
 

[解决办法]
代码加些注释吧。看着确实蛋疼。。。
[解决办法]

JScript code
function changelocation3(locationid)  {alert('输出');  document.myform.shi.length = 0;    var locationid=locationid;  var i;  for (i=0;i < onecount33; i++)  {  if (subcat33[i][1] == locationid)  { //这句不是很理解  document.myform.shi.options[document.myform.shi.length] = new Option(subcat33[i][0], subcat33[i][2]);  }     }      } 

热点排行