答案:<script>
<!--
/----------无垠网域-------------------/
/----------嘻哈呵嘿-------------------/
/* 切换国家对应省所用的函数 */
function populateSheng()
{
pri = main.country.options(main.country.selectedIndex).value;
var oXMLDoc = new ActiveXObject('MSXML');
sURL = 'http://210.192.103.40/HAS_Client/UserReg/change_place_dshxml.asp?pri=' + pri;
oXMLDoc.url = sURL;
var oRoot=oXMLDoc.root;
if(oRoot.children != null)
{
//删除省选择框中的所有选项
for(var i=main.province.options.length-1;i>=0;--i)
{
main.province.options.remove(i)
}
var i=0;
//往省选择框中增加选项
while (i<oRoot.children.length)
{
oval = oRoot.children.item(i);
i=i+1;
oname = oRoot.children.item(i);
sval = oval.text;
sname = oname.text;
var oOption = document.createElement('OPTION');
oOption.text = sname;
oOption.value = sval;
main.province.options.add(oOption);
i=i+1;
}
//删除市选择框中的所有选项
for(var i=main.city.options.length-1;i>=0;--i)
{
main.city.options.remove(i)
}
//往市选择框中增加选项
var oOption1 = document.createElement('OPTION');
oOption1.text = "请选择";
oOption1.value = 0;
main.city.options.add(oOption1);
}
}
/* 切换省对应市所用的函数 */
function populateCity()
{
pri = main.province.options(main.province.selectedIndex).value;
var oXMLDoc = new ActiveXObject('MSXML');
sURL = 'http://210.192.103.40/HAS_Client/UserReg/change_place_dchxml.asp?pri=' + pri;
oXMLDoc.url = sURL;
var oRoot=oXMLDoc.root;
if(oRoot.children != null)
{
//删除市选择框中的所有选项
for(var i=main.city.options.length-1;i>=0;--i)
{
main.city.options.remove(i)
}
var i=0;
//往市选择框中增加选项
while (i<oRoot.children.length)
{
oval = oRoot.children.item(i);
i=i+1;
oname = oRoot.children.item(i);
sval = oval.text;
sname = oname.text;
var oOption = document.createElement('OPTION');
oOption.text = sname;
oOption.value = sval;
main.city.options.add(oOption);
i=i+1;
}
}
}
//-->
</script>
<body>
<form name="main" method="post">
国家或地区:<select id=country name=country size=1 onchange=populateSheng()>
<option selected value="">请选择</option>
&n
上一个:燕宗英请进
下一个:利用ASP + XML 架设在线考试系统