博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
免ajax省市三级联动:http://runjs.cn/detail/rcsqficf
阅读量:6939 次
发布时间:2019-06-27

本文共 2134 字,大约阅读时间需要 7 分钟。

/**	全国三级城市联动 js版:http://sandbox.runjs.cn/uploads/rs/267/g3ugugjp/area.js
*       SRC:http://runjs.cn/detail/rcsqficf*/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
0 || !v){ if(dsy.Exists(str)){ ar = dsy.Items[str]; for(i=0;i

源代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>全国城市三级联动</title>
<style type="text/css">
body{ background:#EEEEEE;margin:0; padding:0; font-family:"微软雅黑", Arial, Helvetica, sans-serif; }
a{ color:#006600; text-decoration:none;}
a:hover{color:#990000;}
.top{ margin:5px auto; color:#990000; text-align:center;}
.info select{ border:1px #993300 solid; background:#FFFFFF;}
.info{ margin:5px; text-align:center;}
.info #show{ color:#3399FF; }
.bottom{ text-align:right; font-size:12px; color:#CCCCCC; width:1000px;}
</style>
</head>
<body>
<div class="top">
<h1>全国城市三级联动</h1>
</div>
<div class="info">
<div>
<select id="s_province" name="s_province"></select>  
    <select id="s_city" name="s_city" ></select>  
    <select id="s_county" name="s_county"></select>
    <script class="resources library" src="http://sandbox.runjs.cn/uploads/rs/267/g3ugugjp/area.js" type="text/javascript"></script>
    
    <script type="text/javascript">_init_area();</script>
    </div>
    <div id="show"></div>
</div>
<script type="text/javascript">
var Gid  = document.getElementById ;
var showArea = function(){
Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +
Gid('s_city').value + " - 县/区" + 
Gid('s_county').value + "</h3>"
}
Gid('s_county').setAttribute('onchange','showArea()');
</script>
</body>
</html>

CSS:

button{

border:1px solid #ccc;
cursor:pointer;
  display:block;
  margin:auto;
  position:relative;
  top:100px;
}

原文:http://runjs.cn/detail/rcsqficf

下载:http://download.csdn.net/detail/cometwo/9371651

转载地址:http://vaqjl.baihongyu.com/

你可能感兴趣的文章
在asp.net中执行应用程序
查看>>
C语言:其他进制转换为十进制(方法二)
查看>>
Asp.net MVC2.0系列文章-编辑和删除新闻操作
查看>>
Oracle之:Function :strFormatDate()
查看>>
[摘录]第一部分 掌舵领航(3)
查看>>
理解printk函数【转】
查看>>
Android采取async框架文件上传
查看>>
DataGrid 完全攻略之七(实现选择、编辑和修改)
查看>>
在sublime-text中设置浏览器预览
查看>>
wordpress如何携带cookie模拟浏览器访问网站
查看>>
5.5. Interface
查看>>
Python天天美味(34) - Decorators详解
查看>>
fork,你拿什么证明你的写时拷贝(COW)
查看>>
Android访问WCF服务(使用json实现参数传递)
查看>>
转化一下解决问题的思路,弯道超车
查看>>
Spring MVC表单处理
查看>>
reduction
查看>>
NSubstitute完全手册(十二)使用回调函数和WhenDo语法
查看>>
IOS开发(objective-c)~开篇有理
查看>>
1.3. display
查看>>