日期:2014-05-16 浏览次数:20335 次
$(document).ready(function(){
//JobLocation焦点获得
$('#JobLocation').focus(function(){
$.ajax({
url: 'http://192.168.170.85:8080/awp/widget/Prefecture!getAll',
dataType: 'jsonp',
jsonp:'callback',
cache:false,
type:'GET',
success: function(json) {
prefectureFilling('geoShow',json.prefectureList);
$('#geoShow').show();
}
});
});
//向一个div中填充地区列表
function prefectureFilling(divID,prefectureList){
$('#'+divID).empty();
//一最外层div块开头
var entireDiv='<div id="cityLocation">';
//①①添加提示文字div块
entireDiv += '<!-- 提示文字 --><div id="cityLocationTit" class="cityListNotice"><span style="line-height:30px;">城市列表</span><span style="float:right"><img src="../image/close1.png" title="关闭" alt="关闭" style="cursor:hand" id="imgClose"/></span></div>';
//关闭按钮添加悬浮和点击事件
$('#imgClose').live('mouseover',function(){
$(this).attr('src','../image/close2.png');
});
$('#imgClose').live('mouseout',function(){
$(this).attr('src','../image/close1.png');
});
$('#imgClose').live('click',function(){
$('#'+divID).hide();
});
//②添加热点城市div块开头
entireDiv += '<!-- 热点城市 --><div id="cityHot clearfix">';
//1-添加热点城市提示文字:热门
entireDiv += '<span class="hotTSpan">热门:</span>';
//2-添加详细热点城市ul+li
entireDiv += '<ul id="cityHotUl">';
//得到热点城市列表
var hotList = new Array();
var hID = 0;
for(var m=0;m<prefectureList.length;m++){
if('hot' == prefectureList[m].MARK){
hotList[hID] = prefectureList[m];
hID++;
}
}
//循环添加热点城市li标签
for(var i=0;i<hotList.length;i++){
entireDiv += '<li class="hotCityLi" id="hotCityLi'+i+'" cityName="'+hotList[i].FULLNAME+'" cityID="'+hotList[i].GCODE+'">'+hotList[i].CNNAME+'</li>';
//给热点城市添加点击事件
$('#hotCityLi'+i).live('click',function(){
$('#JobLocation').val($(this).attr('cityName'));
$('#CompanyLocation').val($(this).attr('cityName'));
$('#locationID').val($(this).attr('cityID'));
$('#cityLoc