微信图片_20210710193906.png

取青海省有哪些市

select * from city where parentnodeid='63';

取市有哪些区县

select * from city where parentnodeid='6301';

区县有哪些街道

select * from city where parentnodeid='630102';
四个地方取四个DIV ID
HTML DIV范例:
<div style="border:1px solid #95BBE7;font-size:13px;float:left;width:220px;margin:8px 0px 8px 8px;>
<div id="title" style="background-color:#E0ECFF;height:28px;line-height:28px;border-bottom:1px solid #95B8E7;">&nbsp;省份</div>
<div id="province" style="overflow:auto;height:352px;padding:2px 2px 4px 8px;"></div>
</div>
JS:
$(function(){
var p ={};
p.parentnodeid='';  //省份没有父节点
rs=myRunSqlProcedure('xxx',p);
rows=rs.rows;
str='';
for(var i=0;i<rows.length;i++){
      str+='<span style="display:inline-block;width:190px;"><a href="javascript:fn1(\''+rows[i].areaid
+'\')">' +rows[i].areaname +'</a></span>';
   }
$('#province').html(str);
$('#city').html('');
$('#district').html('');
$('#town').html('');
});

注:传Level为fn1函数用,用来判断输出到哪个层

即javascript:fn1(\''+rows[i].areaid+'\','+rows[i].level+')
function fn1(areaid)
{
var p ={};
p.parentnodeid=areaid;  //
rs=myRunSqlProcedure('xxx',p);
rows=rs.rows;
str='';
for(var i=0;i<rows.length;i++){
      str+='<span style="display:inline-block;width:190px;"><a href="javascript:fn1(\''+rows[i].areaid
+'\')">' +rows[i].areaname +'</a></span>';
   }
$('#province').html(str);
}
判断输出语句

if(level==1){
     $('#city').html(str);
     $('#district').html('');
     $('#town').html('');
}
elseif(level==2){
     $('#district').html(str);
     $('#town').html('');
}
elseif(level==3)$('#town').html(str);

//title里面加点过的值,把areaname传入fn1函数里
分页系统:
body里第一层 overflow-y:hidden  竖的滚动条不需要
表头table标签不加border

标签: none

添加新评论