日期:2014-05-17  浏览次数:20989 次

从数据库中取国家,省份,城市的三级联动,可每次需重新刷新页面。可不可以不需要刷新页面。
如题。
  if   pa_pr_city   <>   " "   then
      sqlstr   =   "select   *   from   li_district   where   li_city_code= "   &transtr(pa_pr_city)  
    set   rs=sysGetRs(sqlstr,cn,0,false)
      strdistrict   =   " <option   value= ' '   selected   > </option> "
      do   while   not   rs.eof
if   cstr(rs( "li_district_code "))   =   cstr(pa_district_code)   then
      strdistrict   =   strdistrict   &   " <option   value= ' "   &   rs( "li_district_code ")   &   " '   selected> "   &   rs( "li_district_name_lcl ")   &   " </option> "
  else
      strdistrict   =   strdistrict   &   " <option   value= ' "   &   rs( "li_district_code ")   &   " '> "   &   rs( "li_district_name_lcl ")   &   " </option> "
  end   if
      rs.movenext
      loop
      rs.close
  end   if


城市: <select   onChange= "changecity(this.value) "   name= "pa_pr_city "   style= "width:60px; "   nonull= "yes ">
    <%=strcity%>
</select>

------解决方案--------------------
用脚本来实现
<form id= "form1 ">
<select name= "aa " onchange= "return aa_onchange() "> </select>
<select name= "bb "> </select>
</form>

<script id= "Zw " type= "text/javascript "> </script>
<SCRIPT LANGUAGE=javascript>
function aa_onchange(i) {
Zw.src = "Zw.asp ";
}
</SCRIPT>

在zw.asp中查询出需要的数据,以循环写入
for ....
itemStr = "var item=new Option( ' " & RS( "ZwName ") & " ', " & RS( "ID ") & "); "
itemStr = itemStr & "form1.bb " & SelID & ".add(item); "
Response.Write itemStr
next
------解决方案--------------------
<form id= "myform " name= "myform " method= "post " action= "Modi_pro.asp ">
<tr>
<td height= "20 " colspan= "5 " nowrap= "nowrap " bgcolor= "#CACACA "> 产品查询: <strong> 一级:
<select name= "class1 " onChange= "redirect1(this.options.value); " >
<option> 请选择类别 </option>
<%Set RS1=fSelect( "View_Class ", "DISTINCT class1_id,class1 ", "1=1 ")
if rs1.eof then %>
<option> 没有设置类别 </option>
<% else
do while not rs1.eof %>
<option value= " <%=trim(rs1( "class1_id "))%> "> <%=trim(rs1( "class1 "))%> </option>
<% rs1.movenext
loop
end if
%>
</select>
二级: