省市县三级联动 <!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>main</title> | |
<script src="js/jquery.min.js"></script> | |
<link rel="stylesheet" rev="stylesheet" href="../css/style.css" type="text/css" media="all" /> | |
<style type="text/css"> | |
<!-- | |
.atten {font-size:12px;font-weight:normal;color:#F00;} | |
--> | |
</style> | |
</head> | |
<body class="ContentBody"> | |
<script> | |
function checkForm(){ | |
if($("#title").val()==""){ | |
alert("请填写文章标题"); | |
return false; | |
} | |
return true; | |
} | |
</script> | |
<script> | |
function province_change(){ | |
var region_id = $("#province").val(); | |
//$('#citys').show(); | |
$('#county').hide(); | |
$('#county').get(0).options.length=1; | |
if (region_id){ | |
$.ajax({ | |
type: "POST", | |
url: "index.php?c=index&m=get_region_list", | |
cache: false, | |
data: "parentid="+region_id, | |
success: function(msg){ | |
//alert(msg); | |
if(msg!="null"){ | |
$('#citys').show(); | |
} | |
else{ | |
$('#citys').hide(); | |
} | |
$('#citys').get(0).options.length=1; | |
if (msg!='null'){ | |
var param = eval(msg); | |
for (j=0;j<param.length ;j++ ){ | |
$('#citys').get(0).options.add(new Option(param[j]['classname'],param[j]['id'])); | |
} | |
} | |
} | |
}); | |
} | |
} | |
function city_change(){ | |
var region_id = $("#citys").val(); | |
//$('#county').show(); | |
if (region_id){ | |
$.ajax({ | |
type: "POST", | |
url: "index.php?c=index&m=get_region_list", | |
cache: false, | |
data: "parentid="+region_id, | |
success: function(msg){ | |
//alert(msg); | |
if(msg!="null"){ | |
$('#county').show(); | |
} | |
else{ | |
$('#county').hide(); | |
} | |
$('#county').get(0).options.length=1; | |
if (msg!='null'){ | |
var param = eval(msg); | |
for (j=0;j<param.length ;j++ ){ | |
$('#county').get(0).options.add(new Option(param[j]['classname'],param[j]['id'])); | |
} | |
} | |
} | |
}); | |
} | |
} | |
</script> | |
<form action="index.php?c=index&m=saveArticle" method="post" name="fom" id="fom" onsubmit="javascript:return checkForm();"> | |
<div class="MainDiv"> | |
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent"> | |
<tr> | |
<th class="tablestyle_title" >文章添加页面</th> | |
</tr> | |
<tr> | |
<td class="CPanel"> | |
<table border="0" cellpadding="0" cellspacing="0" style="width:100%"> | |
<TR> | |
<TD width="100%"> | |
<fieldset style="height:100%;"> | |
<legend>添加文章</legend> | |
<table border="0" cellpadding="2" cellspacing="1" style="width:100%"> | |
<tr> | |
<td nowrap align="right" width="13%">文章标题:</td> | |
<td width="41%"><input value="" name="title" id="title" class="text" style="width:250px" type="text" size="40" /> | |
<span class="red"> *</span></td> | |
</tr> | |
<tr> | |
<td nowrap align="right">文章所属类别:</td> | |
<td> | |
<select name="province" id="province" onchange="province_change();"> | |
<option value='0'>一级类别</option> | |
<option value='1'>首 页</option> | |
<option value='2'>汽车维修</option> | |
<option value='3'>汽车保养</option> | |
<option value='4'>保险代理</option> | |
<option value='5'>事故理赔</option> | |
<option value='6'>其它服务</option> | |
<option value='7'>汽车知识</option> | |
<option value='8'>在线留言</option> | |
<option value='9'>关于我们</option> | |
</select> | |
<select name="city" id="citys" style="display:none;" onchange="city_change();"> | |
<option value='0'>二级类别</option> | |
</select> | |
<select name="county" id="county" style="display:none;"> | |
<option value='0'>三级类别</option> | |
</select> | |
</td> | |
</tr> | |
<tr> | |
<td nowrap align="right" height="120px">任务说明:</td> | |
<td colspan="3"> | |
<link rel="stylesheet" href="../kindeditor/themes/default/default.css" /> | |
<script charset="utf-8" src="../kindeditor/kindeditor-min.js"></script> | |
<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script> | |
<script> | |
var editor; | |
KindEditor.ready(function(K) { | |
editor = K.create('textarea[name="content"]', { | |
allowFileManager : true | |
}); | |
}); | |
</script> | |
<textarea name="content" id="content" style="width:670px;height:600px;"></textarea> | |
</td> | |
</tr> | |
<tr> | |
<td align=right>添加时间:</td> | |
<td> | |
<link rel="stylesheet" type="text/css" href="calendar/jscal2.css"/> | |
<link rel="stylesheet" type="text/css" href="calendar/border-radius.css"/> | |
<link rel="stylesheet" type="text/css" href="calendar/win2k.css"/> | |
<script type="text/javascript" src="calendar/calendar.js"></script> | |
<script type="text/javascript" src="calendar/lang/en.js"></script> | |
<input type="text" name="addtime" id="addtime" class="date" value="2014-05-23 13:11:24" readonly style="cursor:pointer;"> | |
<script type="text/javascript"> | |
Calendar.setup({ | |
weekNumbers: false, | |
inputField : "addtime", | |
trigger : "addtime", | |
dateFormat: "%Y-%m-%d %H:%M:%S", | |
showTime: true, | |
minuteStep: 1, | |
onSelect : function() {this.hide();} | |
}); | |
</script> | |
</td> | |
</tr> | |
</table> | |
</fieldset> | |
</TD> | |
</TR> | |
</TABLE> | |
</td> | |
</tr> | |
<TR> | |
<TD colspan="2" align="center" height="50px"> | |
<input type="hidden" name="article_id" id="article_id" value=""> | |
<input type="submit" name="Submit" value="保存" class="button"> | |
<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/></TD> | |
</TR> | |
</TABLE> | |
</td> | |
</tr> | |
</table> | |
</div> | |
</form> | |
</body> | |
</html>
index.php
function get_region_list(){
function get_region_list($parentid){
|