📄 areacityselector_b.js
字号:
CLOptions[ii][jj++] = "甘肃-定西|├-定西市"
CLOptions[ii][jj++] = "甘肃-陇南|├-陇南"
CLOptions[ii][jj++] = "甘肃-甘南|├-甘南州"
CLOptions[ii++][jj++] = "甘肃-其他|└-其他"
jj = 0
// ii = 27
CLOptions[ii] = new Array()
CLOptions[ii][jj++] = "宁夏-银川|├-银川市"
CLOptions[ii][jj++] = "宁夏-青铜峡|├-青铜峡市"
CLOptions[ii][jj++] = "宁夏-吴忠|├-吴忠市"
CLOptions[ii][jj++] = "宁夏-石嘴山|├-石嘴山市"
CLOptions[ii][jj++] = "宁夏-固原|├-固原市"
CLOptions[ii][jj++] = "宁夏-中卫|├-中卫市"
CLOptions[ii][jj++] = "宁夏-灵武|├-灵武市"
CLOptions[ii++][jj++] = "宁夏-其他|└-其他"
jj = 0
// ii = 28
CLOptions[ii] = new Array()
CLOptions[ii][jj++] = "青海-西宁|├-西宁市"
CLOptions[ii][jj++] = "青海-海东|├-海东"
CLOptions[ii][jj++] = "青海-海北|├-海北州"
CLOptions[ii][jj++] = "青海-黄南|├-黄南州"
CLOptions[ii][jj++] = "青海-海南|├-海南州"
CLOptions[ii][jj++] = "青海-果洛|├-果洛州"
CLOptions[ii][jj++] = "青海-玉树|├-玉树州"
CLOptions[ii][jj++] = "青海-海西|├-海西州"
CLOptions[ii++][jj++] = "青海-其他|└-其他"
jj = 0
// ii = 29
CLOptions[ii] = new Array()
CLOptions[ii][jj++] = "新疆-乌鲁木齐|├-乌鲁木齐市"
CLOptions[ii][jj++] = "新疆-克拉玛依|├-克拉玛依市"
CLOptions[ii][jj++] = "新疆-吐鲁番|├-吐鲁番市"
CLOptions[ii][jj++] = "新疆-哈密|├-哈密市"
CLOptions[ii][jj++] = "新疆-昌吉|├-昌吉市"
CLOptions[ii][jj++] = "新疆-博乐|├-博乐市"
CLOptions[ii][jj++] = "新疆-库尔勒|├-库尔勒市"
CLOptions[ii][jj++] = "新疆-阿克苏|├-阿克苏市"
CLOptions[ii][jj++] = "新疆-阿图什|├-阿图什市"
CLOptions[ii][jj++] = "新疆-喀什|├-喀什市"
CLOptions[ii][jj++] = "新疆-和田|├-和田市"
CLOptions[ii][jj++] = "新疆-伊宁|├-伊宁市"
CLOptions[ii][jj++] = "新疆-塔城|├-塔城市"
CLOptions[ii][jj++] = "新疆-阿勒泰|├-阿勒泰市"
CLOptions[ii][jj++] = "新疆-石河子|├-石河子市"
CLOptions[ii][jj++] = "新疆-阿拉尔|├-阿拉尔市"
CLOptions[ii][jj++] = "新疆-图木舒克|├-图木舒克市"
CLOptions[ii][jj++] = "新疆-五家渠|├-五家渠市"
CLOptions[ii++][jj++] = "新疆-其他|└-其他"
jj = 0
// ii = 30
CLOptions[ii] = new Array()
CLOptions[ii][jj++] = "西藏-拉萨|├-拉萨市"
CLOptions[ii][jj++] = "西藏-昌都|├-昌都"
CLOptions[ii][jj++] = "西藏-山南|├-山南"
CLOptions[ii][jj++] = "西藏-日喀则|├-日喀则"
CLOptions[ii][jj++] = "西藏-那曲|├-那曲"
CLOptions[ii][jj++] = "西藏-阿里|├-阿里"
CLOptions[ii][jj++] = "西藏-林芝|├-林芝"
CLOptions[ii++][jj++] = "西藏-其他|└-其他"
jj = 0
// ii = 31
CLOptions[ii] = new Array()
CLOptions[ii][jj++] = "台湾-台北|├-台北市"
CLOptions[ii][jj++] = "台湾-高雄|├-高雄市"
CLOptions[ii][jj++] = "台湾-基隆|├-基隆市"
CLOptions[ii][jj++] = "台湾-台中|├-台中市"
CLOptions[ii][jj++] = "台湾-台南|├-台南市"
CLOptions[ii][jj++] = "台湾-新竹|├-新竹市"
CLOptions[ii][jj++] = "台湾-嘉义|├-嘉义市"
CLOptions[ii++][jj++] = "台湾-其他|└-其他"
jj = 0
// ii = 32
CLOptions[ii] = new Array()
CLOptions[ii++][jj++] = "香港-|香港特别行政区"
jj = 0
// ii = 33
CLOptions[ii] = new Array()
CLOptions[ii++][jj++] = "澳门-|澳门特别行政区"
jj = 0
// ii = 34
CLOptions[ii] = new Array()
CLOptions[ii++][jj++] = "国外-|国外"
ii = 0
jj = 0
}
// Place Associate List Object
function PlaceAssociateList(instance, parent, child, optionList)
{
this.parent = parent; // 父选择框
this.child = child; // 子选择框
this.instance = instance; // 与对象关联的选择框实例
this.optionList = optionList; // 选择框选项列表
this.initValue = null; // 选择框初始值
this.addedOptions = null; // 附加选项
this.incPValue = false; // 包含父值
this.incPValueFormat = "%PText%"; // 包含父值的选项的文本格式
this.allowEmpty = false; // 允许空选项列表
this.init = InitPlaceSelector; // 初始化方法
this.SetSelectedValue = SetSelectedValue; // 设置选中值方法
this.instance.associateObject = this; // 关联对象与选择框
}
// 选择列表初始化方法
function InitPlaceSelector()
{
if( this.instance ) // 实例存在
{
var i, aIndex, aLength, aValueText;
if( this.child || this.parent == null ) // 子选择框存在, 则实例为父选择框;
{
this.instance.length = 0; // 清空实例
if( this.addedOptions != null ) // 附加选项
{
for( i = 0; i<this.addedOptions.length; i++ )
{
aValueText = this.addedOptions[i].split("|");
if( aValueText.length > 0 ) // 添加选项
{
this.instance.options[this.instance.length] = new Option(aValueText[1], aValueText[0]);
if( aValueText[0] == this.initValue ) // 选中初始值
this.instance.options[this.instance.length-1].selected = true;
}
}
}
for( i = 0; i<this.optionList.length; i++ )
{
aValueText = this.optionList[i].split("|");
if( aValueText.length > 0 ) // 添加选项
{
this.instance.options[this.instance.length] = new Option(aValueText[1], aValueText[0]);
if( aValueText[0] == this.initValue ) // 选中初始值
this.instance.options[this.instance.length-1].selected = true;
}
}
if( this.child ) this.instance.onchange = areaChanged
}
else if( this.parent ) // 父选择框存在, 则实例为子选择框
{
this.parent.onchange();
}
}
}
// 父选择列表值改变事件方法
function areaChanged()
{
if( this.associateObject )
{
var i, aLength, aObject, aChildObject, aIndex, aValueText;
var aParentValue, aParentText;
aObject = this.associateObject;
aChildObject = aObject.child.associateObject;
aParentValue = this.options[this.selectedIndex].value;
aParentText = this.options[this.selectedIndex].text;
aLength = 0;
aObject.child.length = 0; // 清空实例
if( aObject.addedOptions ) // 父选择框附加选项数
aLength = aObject.addedOptions.length;
if( this.selectedIndex >= aLength ) // 父选择框选中项不在附加选项中
{
aIndex = this.selectedIndex - aLength;
if( aChildObject.incPValue ) // 包含父值
{
aObject.child.options[aObject.child.length] = new Option(
aChildObject.incPValueFormat.replace("%PText%", this.options[this.selectedIndex].text),
aParentValue);
if( aParentValue == aChildObject.initValue ) // 选中初始值
aObject.child.options[aObject.child.length-1].selected = true;
}
for( i=0; i<aChildObject.optionList[aIndex].length; i++ )
{
aValueText = aChildObject.optionList[aIndex][i].split("|");
if( aValueText.length > 0 && aValueText[0] != aParentValue) // 添加选项
{
aObject.child.options[aObject.child.length] = new Option(aValueText[1], aValueText[0]);
if( aValueText[0] == aChildObject.initValue ) // 选中初始值
aObject.child.options[aObject.child.length-1].selected = true;
}
}
if( !aChildObject.allowEmpty && aObject.child.length == 0)
{
aObject.child.options[aObject.child.length] = new Option(aParentText, aParentValue);
}
}
else
{
if( aChildObject.addedOptions != null ) // 附加选项
{
for( i = 0;i<aChildObject.addedOptions.length; i++ )
{
aValueText = aChildObject.addedOptions[i].split("|");
if( aValueText.length > 0 ) // 添加选项
{
aObject.child.options[aObject.child.length] = new Option(aValueText[1], aValueText[0]);
if( aValueText[0] == aChildObject.initValue ) // 选中初始值
aObject.child.options[aObject.child.length-1].selected = true;
}
}
}
}
}
}
function SetSelectedValue(aValue, aWantProcessed)
{
if( this.instance )
{
var optionValue = aValue;
if( aWantProcessed )
{
var optionValues = optionValue.split("-");
if( optionValues.length > 0 )
optionValue = optionValues[0] + "-";
}
for( i = 0;i<this.instance.options.length; i++ )
{
if( this.instance.options[i].value == optionValue )
{
this.instance.options[i].selected = true;
if( this.child )
{
this.instance.onchange();
this.child.associateObject.SetSelectedValue(aValue, false);
}
break;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -