<script language="javascript">
//-------------------------------------------------------------
var arrayCity = new Array(11);
arrayCity[0] = new Array("PA","太原市","尖草坪区","杏花岭区","万柏区","小店区","晋源区","古交市","阳曲县","清徐县","娄烦县");
arrayCity[1] = new Array("PB","大同市","大同县","灵丘县","左云县","浑源县","广灵县","阳高县","天镇县","南郊区","新荣区");
arrayCity[2] = new Array("PC","阳泉市","盂县","平定县","矿区","城区","郊区");
arrayCity[3] = new Array("PD","长治市","长治县","潞城市","长子县","襄垣县","屯留县","黎城县","壶关县","平顺县","沁县","沁源县","武乡县");
arrayCity[4] = new Array("PE","晋城市","泽州县","高平市","阳城县","沁水县","陵川县");
arrayCity[5] = new Array("PF","朔州市","平鲁区","右玉县","应县","怀仁县","山阴县","朔城区");
arrayCity[6] = new Array("PH","忻州市","忻府区","原平市","代县","定襄县","神池县","河曲县","繁峙县","五台县","保德县","静乐县","偏关县","宁武县","岢岚县","五寨县");
arrayCity[7] = new Array("PJ","吕梁市","离石市","汾阳市","文水县","交口县","临县","兴县","石楼县","柳林县","中阳县","交城县","孝义市","方山县","岚县");
arrayCity[8] = new Array("PK","晋中市","榆次区","祁县","灵石县","左权县","平遥县","寿阳县","和顺县","太谷县","介休市","榆社县","昔阳县");
arrayCity[9] = new Array("PL","临汾市","尧都区","侯马市","汾西县","永和县","乡宁县","古县","蒲县","襄汾县","吉县","安泽县 ","曲沃县","霍州市","隰县","洪洞县","大宁县","浮山县","冀城县");
arrayCity[10] = new Array("PM","运城市","盐湖区","河津市","闻喜县","平陆县","芮城县","稷山县","垣曲县","永济市","新绛县","万荣县","绛县","临猗县","夏县");
function onLoadInfo(objDoc)
{
var ii;
objDoc.formPost.selectCity.length = 0;
objDoc.formPost.selectCityAddr.length = 0;
objDoc.formPost.selectCity.options[objDoc.formPost.selectCity.length] = new Option("-市区-", "0");
objDoc.formPost.selectCityAddr.options[objDoc.formPost.selectCityAddr.length] = new Option("-市区-", "0");
for (ii = 0; ii < arrayCity.length; ii++)
{
objDoc.formPost.selectCity.options[objDoc.formPost.selectCity.length] = new Option(arrayCity[ii][1], ii + 1);
objDoc.formPost.selectCityAddr.options[objDoc.formPost.selectCityAddr.length] = new Option(arrayCity[ii][1], ii + 1);
}
objDoc.formPost.selectCounty.length = 0;
objDoc.formPost.selectCountyAddr.length = 0;
objDoc.formPost.selectCounty.options[objDoc.formPost.selectCounty.length] = new Option("-县区-", "0");
objDoc.formPost.selectCountyAddr.options[objDoc.formPost.selectCountyAddr.length] = new Option("-县区-", "0");
}
//--------------------------------------------------------------
// 改变地市选择触发函数
function onChangeCity(varValue, objSelectCounty, objText)
{
var i;
objSelectCounty.length = 0;
objSelectCounty.options[objSelectCounty.length] = new Option("-县区-", "0");
if (varValue == 0) return;
objText.value = arrayCity[varValue - 1][1] + objText.value;
for (i = 0; i < arrayCity[varValue - 1].length - 2; i++)
{
objSelectCounty.options[objSelectCounty.length] = new Option(arrayCity[varValue - 1][i + 2], arrayCity[varValue - 1][i + 2]);
}
}
//--------------------------------------------------------------
// 自动填充文本框内容函数
function onChangeCounty(varValue, objText)
{
if (varValue == 0) return;
objText.value = objText.value + varValue;
}
</script>
<body onload="onLoadInfo(document)">
<form name="formPost">
<input name="textCorpName" type="text" value="">
<select name="selectCity" onChange="onChangeCity(document.formPost.selectCity.options[document.formPost.selectCity.selectedIndex].value, document.formPost.selectCounty, document.formPost.textCorpName)">
</select>
<select name="selectCounty" onChange="onChangeCounty(document.formPost.selectCounty.options[document.formPost.selectCounty.selectedIndex].value, textCorpName)">
</select>
</form>
</body>
[ 此贴被XChinux在2005-08-23 19:53重新编辑 ]