Area.js 3.35 KB

function initComplexArea(a, k, h, p, q, d, b, l) {
    var f = initComplexArea.arguments;
    var m = document.getElementById(a);
    var o = document.getElementById(k);
    var n = document.getElementById(h);
    var e = 0;
    var c = 0;
    if (p != undefined) {
        if (d != undefined) {
            d = parseInt(d);
        }
        else {
            d = 0;
        }
        if (b != undefined) {
            b = parseInt(b);
        }
        else {
            b = 0;
        }
        if (l != undefined) {
            l = parseInt(l);
        }
        else {
            l = 0
        }
        o[0] = new Option("请选择 ", 0);
        n[0] = new Option("请选择 ", 0);
        for (e = 0; e < p.length; e++) {
            if (p[e] == undefined) {
                continue;
            }
            if (f[6]) {
                if (f[6] == true) {
                    if (e == 0) {
                        continue
                    }
                }
            }
            m[c] = new Option(p[e], e);
            if (d == e) {
                m[c].selected = true;
            }
            c++
        }
        if (q[d] != undefined) {
            c = 0; for (e = 0; e < q[d].length; e++) {
                if (q[d][e] == undefined) { continue }
                if (f[6]) {
                    if ((f[6] == true) && (d != 71) && (d != 81) && (d != 82)) {
                        if ((e % 100) == 0) { continue }
                    }
                } o[c] = new Option(q[d][e], e);
                if (b == e) { o[c].selected = true } c++
            }
        }
    }
}

function changeComplexProvince(f, k, e, d) {
	//获取当前js函数的参数集合
	var c = changeComplexProvince.arguments; 
	//获取地籍区对象
	var h = document.getElementById(e);
	//获取地籍子区对象
	var g = document.getElementById(d);
	removeOptions(h); 
	var str = "";
	f = parseInt(f);
	//$("#" + e).html('<option value="0" >请选择</option>');
	if (k[f] != undefined) {
	    str += "<option value='0' >请选择</option>";
	    for(var i = 1; i < 150; i++){        	
	        if(i <= 9){
    				i = "00"+ i;
    		}else if(i>9 && i <= 99){
    				i = "0"+ i;
    		} 
	        if (k[f][parseInt(f.toString() + i.toString())] == undefined) continue;
    		str += "<option value='" + f.toString() + i.toString() + "' >" + k[f][parseInt(f.toString() + i.toString())] + "</option>";
	    }
	    $("#" + e).html(str);
	}
	removeOptions(g); 
	g[0] = new Option("请选择 ", 0);
}


function changeCity(c, a) {
	$("#" + a).html('<option value="0" >请选择</option>');
	$("#" + a).unbind("change");
	c = parseInt(c);
	var str = "";
	var ii = "000";
	str += "<option value='0' >请选择</option>";
	for (var i = 1; i < 300; i++) {
		if(i <= 9){
			i = "00"+ i;
		}else if(i>9 && i <= 99){
			i = "0"+ i;
		}
	    if (sub_arr[c][parseInt(c.toString() + i.toString())] == undefined) continue;
	    str += "<option value='" + c.toString() + i.toString() + "' >" + sub_arr[c][parseInt(c.toString() + i.toString())] + "</option>";
	}
    str += "<option value='" + c.toString() + ii.toString() + "' >" + sub_arr[c][parseInt(c.toString() + ii.toString())] + "</option>";

	$("#" + a).html(str);
}

function removeOptions(c) {
    if ((c != undefined) && (c.options != undefined)) {
        var a = c.options.length;
        for (var b = 0; b < a; b++) {
            c.options[0] = null;
        }
    }
}