//省市地3级联动下拉菜单函数 regionss 省.市.地 function regionss($country="中华人民共和国") { global $db; $i = 1; $text=""; $text.=" \n"; $text.="\n"; return $text;
}
regions.js 的代码:
复制代码 代码如下:
//var ab = new Array(); var xmlHttp; var xmlHttpa; function createXMLHttpRequest() { if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } } function createXMLHttpRequesta() { if (window.ActiveXObject) { xmlHttpa = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { xmlHttpa = new XMLHttpRequest(); } }
$result = $db->query("SELECT DISTINCT city FROM ".TABLE_CITY." WHERE province='$province' ORDER BY cityid"); while($r = $db->fetch_array($result)) { $r[city]=iconv('gb2312','UTF-8',$r[city]); echo "obj.options[obj.options.length] = new Option('".$r[city]."','".$r[city]."');\n"; $i++; } $resultarea = $db->query("SELECT DISTINCT city FROM ".TABLE_CITY." WHERE province='$province' ORDER BY cityid"); $r = $db->fetch_array($resultarea); $city = $r[city]; $resulta = $db->query("SELECT DISTINCT area FROM ".TABLE_CITY." WHERE city='$city' ORDER BY cityid"); while($ra = $db->fetch_array($resulta)) { $ra[area]=iconv('gb2312','UTF-8',$ra[area]); echo "obja.options[obja.options.length] = new Option('".$ra[area]."','".$ra[area]."');\n"; $i++; }
} if($city && $province==''){ global $db; $i = 1;
$result = $db->query("SELECT DISTINCT area FROM ".TABLE_CITY." WHERE city='$city' ORDER BY cityid"); while($r = $db->fetch_array($result)) { $r[area]=iconv('gb2312','UTF-8',$r[area]); echo "obja.options[obja.options.length] = new Option('".$r[area]."','".$r[area]."');\n"; $i++; } } ?>
地址信息数据库:
采用的是phpcms3.0里自带的数据库,我没有进行任何改动
本程序可以在phpcms3.0里直接使用,若在其他地方使用请自己修改
http://www.bkjia.com/PHPjc/317597.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317597.htmlTechArticle绝对原创 测试地址:http://www.mlmm.cn/mypage/?name=ceshi 测试页代码: 复制代码 代码如下: html head metahttp-equiv="Content-Type"content="text/html;charset=gb2...
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn