楼盘列表
$(function() {
//获取网址参数
var url = document.URL;
var urlArr = url.split(“/”);
var urlUseArr = urlArr[3].split(“?”);
var urlPamArr = urlUseArr[1].split(“&”);
var urlReset = ”;
for (var i = 0; i < urlPamArr.length; i++) {
var urlPamSigleArr = urlPamArr[i].split(“=”);
if (urlPamSigleArr[0] == ‘area’) {
var areaList = $(‘#area_loop option’);
for (var j = 0; j < areaList.length; j++) {
if (urlPamSigleArr[1] == encodeURI(areaList[j].innerHTML)) {
areaList[j].selected = ‘selected’;
}
}
}
}
$(‘#area_loop’).change(function() {
redirect($(this), ‘area’);
});
function redirect(obj, pamName) {
var flag = true;
for (var i = 0; i < urlPamArr.length; i++) {
var urlPamName = urlPamArr[i].split(“=”)[0];
if (urlPamName == pamName) {
urlReset = ‘/’ + urlUseArr[0] + ‘?’;
if (obj.val() == ”) {
urlPamArr[i] = ”;
} else {
urlPamArr[i] = obj.val().substr(1);
}
for (var j = 0; j < urlPamArr.length; j++) {
if (urlPamArr[j] != ”) {
if (j == 0) {
urlReset += urlPamArr[j];
} else {
urlReset += ‘&’ + urlPamArr[j];
}
}
}
flag = false;
break;
}
}
if (flag) {
urlReset = url + obj.val()
}
location = urlReset;
}
})