当前位置:编程学习 > html/css >>

易做图联动省市地区例子

[html]
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> 
<% 
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 
%> 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
  <head> 
    <base href="<%=basePath%>"> 
     
    <title>My JSP 'index4.jsp' starting page</title> 
     
    <meta http-equiv="pragma" content="no-cache"> 
    <meta http-equiv="cache-control" content="no-cache"> 
    <meta http-equiv="expires" content="0">     
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> 
    <meta http-equiv="description" content="This is my page"> 
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    --> 
    <style> 
body,select 

 font-size:9pt; 
 font-family:Verdana; 



 color:red; 
 text-decoration:none; 

a:hover{ 
 text-decoration:underline; 

</style> 
<SCRIPT LANGUAGE="JavaScript"> 
<!-- 
function Dsy() 

 this.Items = {}; 

Dsy.prototype.add = function(id,iArray) 

 this.Items[id] = iArray; 

Dsy.prototype.Exists = function(id) 

 if(typeof(this.Items[id]) == "undefined") return false; 
 return true; 

 
function change(v){ 
 var str="0"; 
 for(i=0;i<v;i++){ str+=("_"+(document.getElementById(s[i]).selectedIndex-1));}; 
 var ss=document.getElementById(s[v]); 
 with(ss){ 
  length = 0; 
  options[0]=new Option(opt0[v],opt0[v]); 
  if(v  &&  document.getElementById(s[v-1]).selectedIndex>0 || !v) 
  { 
   if(dsy.Exists(str)){ 
    ar = dsy.Items[str]; 
    for(i=0;i<ar.length;i++)options[length]=new Option(ar[i],ar[i]); 
    if(v)options[1].selected = true; 
   } 
  } 
  if(++v<s.length){change(v);} 
 } 

 
var dsy = new Dsy(); 
dsy.add("0",["安徽","北京","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","天津","易做图","新疆","云南","浙江","重庆"]); 
dsy.add("0_0",["安庆","蚌埠","巢湖","池州","滁州","阜阳","合肥","淮北","淮南","黄山","六安","马鞍山","宿州","铜陵","芜湖","宣城","亳州"]); 
dsy.add("0_0_0",["安庆市","怀宁县","潜山县","宿松县","太湖县","桐城市","望江县","岳西县","枞阳县"]); 
dsy.add("0_0_1",["蚌埠市","固镇县","怀远县","五河县"]); 
dsy.add("0_0_2",["巢湖市","含山县","和县","庐江县","无为县"]); 
dsy.add("0_0_3",["池州市","东至县","青阳县","石台县"]); 
dsy.add("0_0_4",["滁州市","定远县","凤阳县","来安县","明光市","全椒县","天长市"]); 
dsy.add("0_0_5",["阜南县","阜阳市","界首市","临泉县","太和县","颖上县"]); 
dsy.add("0_0_6",["长丰县","肥东县","肥西县"]); 
dsy.add("0_0_7",["淮北市","濉溪县"]); 
dsy.add("0_0_8",["凤台县","淮南市"]); 
dsy.add("0_0_9",["黄山市","祁门县","休宁县","歙县","黟县"]); 
dsy.add("0_0_10",["霍邱县","霍山县","金寨县","六安市","寿县","舒城县"]); 
dsy.add("0_0_11",["当涂县","马鞍山市"]); 
dsy.add("0_0_12",["灵璧县","宿州市","萧县","泗县","砀山县"]); 
dsy.add("0_0_13",["铜陵市","铜陵县"]); 
dsy.add("0_0_14",["繁昌县","南陵县","芜湖市","芜湖县"]); 
dsy.add("0_0_15",["广德县","绩溪县","郎溪县","宁国市","宣城市","泾县","旌德县"]); 
dsy.add("0_0_16",["利辛县","蒙城县","涡阳县","亳州市"]); 
 
dsy.add("0_1",["北京"]); 
dsy.add("0_1_0",["北京市","密云县","延庆县"]); 
dsy.add("0_2",["福州","龙岩","南平","宁德","莆田","泉州","三明","厦门","漳州"]); 
dsy.add("0_2_0",["长乐市","福清市","福州市","连江县","罗源县","闽侯县","闽清县","平潭县","永泰县"]); 
dsy.add("0_2_1",["长汀县","连城县","龙岩市","上杭县","武平县","永定县","漳平市"]); 
dsy.add("0_2_2",["光泽县","建阳市","建瓯市","南平市","浦城县","邵武市","顺昌县","松溪县","武夷山市","政和县"]); 
dsy.add("0_2_3",["福安市","福鼎市","古田县","宁德市","屏南县","寿宁县","霞浦县","周宁县","柘荣县"]); 
dsy.add("0_2_4",["莆田市","仙游县"]); 
dsy.add("0_2_5",["安溪县","德化县","惠安县","金门县","晋江市","南安市","泉州市","石狮市","永春县"]); 
dsy.add("0_2_6",["大田县","建宁县","将乐县"
补充:web前端 , HTML/CSS  ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,