上面的没有问题。
但是下面的话就有问题了。奇怪。
程序代码:
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>重庆市工业学校2012年招生网上报名申请表</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<link href="baomin.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="baomin.js"></script>
<style type="text/css">
<!--
.STYLE74 {color: #FF0000}
.STYLE75 {color: #000033}
.STYLE76 {color: #000000}
-->
</style>
<script>
// JavaScript Document
function LoadXML()
{
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = true;
xmlDoc.load("Area.xml");
return xmlDoc;
}
function InitArea()
{
/*获取,引用三个下拉框 */
var dropElement1=document.getElementById("bornfrom2");
var dropElement2=document.getElementById("Select2");
var dropElement3=document.getElementById("Select3");
/*自定义一个方法 把传进来的对象清除 这里清除了三个下拉所有框的选项*/
RemoveDropDownList(dropElement1);
RemoveDropDownList(dropElement2);
RemoveDropDownList(dropElement3);
//var pOption = document.createElement("option");
var pOption = document.createElement('option');
pOption.value = "0";
pOption.text = "全国";
dropElement1.add(pOption);
var cOption = document.createElement("option");
cOption.value = "0";
cOption.text = "全部市";
dropElement2.add(cOption);
var aOption = document.createElement("option");
aOption.value = "0";
aOption.text = "全区县";
dropElement3.add(aOption);
var xmlDoc= LoadXML();
var provinceNodes = xmlDoc.documentElements.childNodes;
//var provinceNodes = xmlDoc.childNodes;
alert(provinceNodes);
if(provinceNodes.length > 0) //provinceNodes.length = 31
{
var province;
var city;
var area;
for(var i=0; i<provinceNodes.length; i++)
{
province = provinceNodes[i];
var pOption = document.createElement("option");
pOption.value = province.getAttribute("name");
pOption.text = province.getAttribute("name");
dropElement1.add(pOption);
}
}
return true;
}
function selectProvince()
{
var dropElement1=document.getElementById("bornfrom2");
var provinceName=dropElement1.options[dropElement1.selectedIndex].text;
var xmlDoc= LoadXML();
var provinceNode = xmlDoc.selectSingleNode("//root/province[@name='"+provinceName+"']"); //alert(provinceNode.getAttribute("name"));
/*XmlNode node = doc.SelectSingleNode("//AllNode/Node[@ID = ’aaa’]");
在整个Xml中查找AllNode节点下的节点名为Node的节点,该子节点的ID属性值为aaa*/
var dropElement2=document.getElementById("Select2");
var dropElement3=document.getElementById("Select3");
RemoveDropDownList(dropElement2);
RemoveDropDownList(dropElement3);
var cOption = document.createElement("option");
cOption.value = "0";
cOption.text = "全部市";
dropElement2.add(cOption);
var aOption = document.createElement("option");
aOption.value = "0";
aOption.text = "全区县";
dropElement3.add(aOption);
for(var i=0; i<provinceNode.childNodes.length; i++)
{
city = provinceNode.childNodes[i];
var cOption = document.createElement("option");
cOption.value = city.getAttribute("name");
cOption.text = city.getAttribute("name");
dropElement2.add(cOption);
}
}
function selectArea()
{
var dropElement2=document.getElementById("Select2");
var cityName=dropElement2.options[dropElement2.selectedIndex].text;
var xmlDoc= LoadXML();
var cityNode = xmlDoc.selectSingleNode("//root/province/city[@name='"+cityName+"']");
var dropElement3=document.getElementById("Select3");
RemoveDropDownList(dropElement3);
var aOption = document.createElement("option");
aOption.value = "0";
aOption.text = "全区县";
dropElement3.add(aOption);
for(var i=0; i<cityNode.childNodes.length; i++)
{
city = cityNode.childNodes[i];
var aOption = document.createElement("option");
aOption.value = city.getAttribute("name");
aOption.text = city.getAttribute("name");
dropElement3.add(aOption);
}
}
function RemoveDropDownList(obj)
{
if(obj)//如果参数obj不为空 则
{
var length=obj.options.length;
if(length > 0)
{
for(var i=length; i>=0;i--)
{
obj.remove(i);
}
}
}
}
</script>
</HEAD>
<BODY class="body" onload="InitArea()">
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff height=3></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD width=5 bgColor=#f9fafc height=97></TD>
<TD align=middle width=534 bgColor=#f9fafc>
<TABLE cellSpacing=0 cellPadding=0 width=799 border=0>
<TBODY>
<TR>
<TD align=middle>
<FORM name=myform onSubmit="return checkinput();" action="baomin_add.asp" method="post">
<TABLE cellSpacing=0 cellPadding=0 width=796 align=center
border=0>
<TBODY>
<TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>出生日期:</DIV></TD>
<TD width=588><select size=1 name=byear>
<option>1970</option>
<option>1971</option>
<option>1972</option>
<option>1973</option>
<option>1974</option>
<option>1975</option>
<option>1976</option>
<option>1977</option>
<option>1978</option>
<option>1979</option>
<option>1980</option>
<option selected>1981</option>
<option>1982</option>
<option>1983</option>
<option>1984</option>
<option>1985</option>
<option>1986</option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
</select>
年
<SELECT size=1
name=bmonth>
<OPTION selected>01</OPTION>
<OPTION>02</OPTION>
<OPTION>03</OPTION>
<OPTION>04</OPTION>
<OPTION>05</OPTION>
<OPTION>06</OPTION>
<OPTION>07</OPTION>
<OPTION>08</OPTION>
<OPTION>09</OPTION>
<OPTION>10</OPTION>
<OPTION>11</OPTION>
<OPTION>12</OPTION>
</SELECT>
月
<SELECT size=1 name=bday>
<OPTION selected>01</OPTION>
<OPTION>02</OPTION>
<OPTION>03</OPTION>
<OPTION>04</OPTION>
<OPTION>05</OPTION>
<OPTION>06</OPTION>
<OPTION>07</OPTION>
<OPTION>08</OPTION>
<OPTION>09</OPTION>
<OPTION>10</OPTION>
<OPTION>11</OPTION>
<OPTION>12</OPTION>
<OPTION>13</OPTION>
<OPTION>14</OPTION>
<OPTION>15</OPTION>
<OPTION>16</OPTION>
<OPTION>17</OPTION>
<OPTION>18</OPTION>
<OPTION>19</OPTION>
<OPTION>20</OPTION>
<OPTION>21</OPTION>
<OPTION>22</OPTION>
<OPTION>23</OPTION>
<OPTION>24</OPTION>
<OPTION>25</OPTION>
<OPTION>26</OPTION>
<OPTION>27</OPTION>
<OPTION>28</OPTION>
<OPTION>29</OPTION>
<OPTION>30</OPTION>
<OPTION>31</OPTION>
</SELECT>
日</TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>身份证号:</DIV></TD>
<TD width=588><INPUT id="usercode" name="usercode" min="1" max="20">
<SPAN
class=STYLE67>(学校录取、资助、建档用,请务必填写正确)</SPAN></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><span class="STYLE67">* </span>家庭住址:</DIV></TD>
<TD width=588><INPUT id="results" name="results" min="1" max="20"></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>*<span class="STYLE75">户籍所在省</span></SPAN>:</DIV></TD>
<TD width=588>
<SELECT size=1 name="bornfrom2" id="bornfrom2" onchange="selectProvince()">
</SELECT></TD>
</TR><TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN><span class="STYLE75">户籍所在市</span>:</DIV></TD>
<TD width=588>
<SELECT size=1 name="Select2" id="Select2" onchange="selectArea()">
</SELECT>
</TD>
</TR><TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN><span class="STYLE75">户籍所在区县</span>:</DIV></TD>
<TD width=588><SELECT size=1 name="Select3" id="Select3">
</SELECT></TD>
</TR><TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>详细地址:</DIV></TD>
<TD width=588><INPUT id="levels" name="levels" min="1" max="20">
(填写镇、村、社或街道办事处、门牌号)</TD>
</TR>
<TR>
<TD><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>户籍性质:</DIV></TD>
<TD><select size=1 name=byear2>
<option value="农村">农村</option>
<option value="县镇非农">县镇非农</option>
<option value="城市">城市</option>
</select>
(填写农村、县镇非农、城市)</TD>
</TR>
<TR>
<TD><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>资助类型:</DIV></TD>
<TD><select size=1 name=byear3>
<option value="普惠制">普惠制</option>
<option value="三峡移民">三峡移民</option>
<option value="农村建卡(低保)户">农村建卡(低保)户</option>
<option value="城镇低保户">城镇低保户</option>
<option value="退伍军人">退伍军人</option>
<option value="孤儿">孤儿</option>
</select>
(填写三峡移民、农村建卡贫困户(低保)、 城镇低保、退伍军人、孤儿等)</TD>
</TR>
<TR>
<TD><DIV class=hang align=right> <SPAN class=STYLE67>* </SPAN>报名层次:</div></TD>
<TD><SELECT id="bselect" name="bselect">
<OPTION value="">--请选择报考层次--</OPTION>
<option value="中专">中专</option>
<option value="中专衔接大专(自考大专)">中专衔接大专(自考大专)</option>
<option value="高技能大专">高技能大专</option>
</SELECT> </TD>
</TR>
<TR>
<TD><DIV class=hang align=right><SPAN class=STYLE67>* </SPAN>报名专业:</DIV></TD>
<TD><SELECT id="firstdesire" name="firstdesire">
<option value="机械制造技术">机械制造技术</option>
<option value="数控技术应用">数控技术应用</option>
<option value="模具制造技术">模具制造技术</option>
<option value="机电技术应用">机电技术应用</option>
<option value="城市轨道交通车辆运营与检修">城市轨道交通车辆运营与检修</option>
<option value="汽车制造与检修">汽车制造与检修</option>
<option value="电气技术应用">电气技术应用</option>
<option value="电子技术应用">电子技术应用</option>
<option value="电子电器应用与维修">电子电器应用与维修</option>
<option value="软件与信息服务">软件与信息服务</option>
<option value="计算机平面设计">计算机平面设计</option>
<option value="电子商务 ">电子商务 </option>
<option value="旅游服务与管理">旅游服务与管理</option>
<option value="会计">会计</option>
<option value="物流服务与管理">物流服务与管理</option>
<option value="建筑工程施工">建筑工程施工</option>
<option value="建筑装饰 ">建筑装饰 </option>
<option value="工程造价">工程造价</option>
<option value="化学工艺">化学工艺</option>
<option value="工业分析与检验">工业分析与检验</option>
<option value="生物化工">生物化工</option>
<option value="药剂">药剂</option>
<option value="计算机游戏与动画">计算机游戏与动画</option>
航海系
</SELECT>
<SPAN class=STYLE67>如:机械制造技术</SPAN> </TD>
</TR>
<TR>
<TD><DIV class=hang align=right>第二志愿:</DIV></TD>
<TD><select id=seconddesire name=seconddesire>
<option value="">--请选择第二志愿--</option>
<option value="机械科">机械科</option>
<option value="化工科">化工科</option>
<option value="工电科">工电科</option>
<option value="经管科">经管科</option>
<option value="建工科">建工科</option>
<option value="计中心">计中心</option>
</select>
<SPAN class=STYLE67>如:英语</SPAN> </TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>现有学历:</DIV></TD>
<TD width=588><SELECT size=1 name="bornfrom4" id="bornfrom4">
<option value="初中学历">初中学历</option>
<option value="高中学历">高中学历</option>
<option value="中职学历">中职学历</option>
<option value="大专学历">大专学历</option>
<option value="其他学历">其他学历</option>
</SELECT></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><span class="STYLE67">* </span>初(高)中毕业学校:</DIV></TD>
<TD width=588><INPUT id="fromschool" name="fromschool">
<span class="STYLE74">(重庆市内例:江津区实验中学;重庆市外例:四川省武胜县东方红中学)</span></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right>初(高)中毕业时间:</DIV></TD>
<TD width=588><select size=1 name=byear4>
<option>1970</option>
<option>1971</option>
<option>1972</option>
<option>1973</option>
<option>1974</option>
<option>1975</option>
<option>1976</option>
<option>1977</option>
<option>1978</option>
<option>1979</option>
<option>1980</option>
<option selected>1981</option>
<option>1982</option>
<option>1983</option>
<option>1984</option>
<option>1985</option>
<option>1986</option>
<option>1987</option>
<option>1988</option>
<option>1989</option>
<option>1990</option>
<option>1991</option>
<option>1992</option>
<option>1993</option>
<option>1994</option>
</select>
年
<SELECT size=1
name=bmonth2>
<OPTION selected>01</OPTION>
<OPTION>02</OPTION>
<OPTION>03</OPTION>
<OPTION>04</OPTION>
<OPTION>05</OPTION>
<OPTION>06</OPTION>
<OPTION>07</OPTION>
<OPTION>08</OPTION>
<OPTION>09</OPTION>
<OPTION>10</OPTION>
<OPTION>11</OPTION>
<OPTION>12</OPTION>
</SELECT>
月</TD>
</TR>
<TR>
<TD><DIV class=hang align=right><SPAN
class=STYLE67>* <span class="STYLE76">学生</span></SPAN>联系电话:</DIV></TD>
<TD><INPUT id="phone2" name="phone2" min="1"
max="20">
<SPAN
class=STYLE67>填写学生保持畅通联系电话,以便学校及时发布信息)</SPAN></TD>
</TR>
<TR>
<TD class=hang><DIV align=right><SPAN
class=STYLE67>* </SPAN>监护人姓名:</DIV></TD>
<TD class=STYLE67><INPUT id="graduatetime2" name="graduatetime2"
min="1" max="20">
(原则上填写户主姓名,如监护人与户主不一致的以实际监护人为准)</TD>
</TR>
<TR>
<TD class=hang><DIV align=right><SPAN
class=STYLE67>* </SPAN>监护人与学生关系:</DIV></TD>
<TD class=STYLE67><INPUT id="graduatetime3" name="graduatetime2"
min="1" max="20"> </TD>
</TR>
<TR>
<TD class=hang><DIV align=right><SPAN
class=STYLE67>* </SPAN>监护人身份证号码:</DIV></TD>
<TD class=STYLE67><INPUT id="graduatetime4" name="graduatetime2"
min="1" max="20"> </TD>
</TR>
<TR>
<TD><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>监护人联系电话:</DIV></TD>
<TD><INPUT id="mobile" name="mobile" max="20">
<SPAN class=STYLE67>(须填写现在在用联系电话,方便有关部门调查核实情况) </SPAN></TD>
</TR>
<TR>
<TD class=hang><DIV align=right><SPAN
class=STYLE67>* </SPAN>监护人工作单位:</DIV></TD>
<TD class=STYLE67><INPUT id="graduatetime6" name="graduatetime2"
min="1" max="20">
(以监护人现在任职单位为准) </TD>
</TR>
<TR>
<TD width=208 height="92"><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>监护人通信地址:</DIV></TD>
<TD width=588><TEXTAREA id="addr" name="addr" rows=3 cols=58 min="1" max="255"></TEXTAREA>
<BR>
<SPAN
class=STYLE67>(建议填写准确详细的通信地址,以确保学校及时将有关学生在校资料及时寄发给监护人)</SPAN></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right><SPAN
class=STYLE67>* </SPAN>邮政编码:</DIV></TD>
<TD width=588><INPUT id="postcode" name="postcode" min="1"
max="20"></TD>
</TR>
<TR>
<TD width=208><DIV class=hang align=right>E-mail:</DIV></TD>
<TD width=588><INPUT id="e_mail" name="e_mail" max="20">
<SPAN
class=STYLE67>填写考生或家长邮箱,如:a63305343@ <TD width=208><DIV class=hang align=right><SPAN lang=zh-cn
xml:lang="zh-cn">你想咨询的问题</SPAN>:</DIV></TD>
<TD width=588><TEXTAREA id="question" name="question" rows=3 cols=50 max="65535"></TEXTAREA>
<DIV align=left></DIV></TD>
</TR>
<TR>
<TD colSpan=2
height=20>
<TABLE cellSpacing=0 cellPadding=0 width="50%"
align=center border=0>
<TBODY>
<TR>
<TD align=middle><INPUT type=submit value=提交报名表 ></TD>
<TD align=middle><INPUT type=reset value=重填报名表 ></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD colSpan=2 height=60><SPAN class=STYLE67>注意:如果按“提交”后没有显示“祝贺您报名成功”的页面,可能是网络故障,请稍后再网上报名,或及时与我们联系用电话报名或E-maill通知我们为你修改。报名电话:<span class="text">023-63307489,63317727,63311363</span> </SPAN> </TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff height=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#a61c4b height=3></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD bgColor=#ffffff height=5></TD></TR></TBODY>
</TABLE>
<script>
</script>
<TABLE cellSpacing=0 cellPadding=0 width=799 align=center border=0>
<TBODY>
<TR>
<TD height=87 align="center" valign="middle" bgColor=#ffffff>地址:重庆市渝中区化龙桥交农村360号 邮政编码:400043 QQ:253612534 电子信箱:<span class="hui">a63305343@ style=display:none></div>
<BR>
联系电话:13320355112,13274044272 <BR>
重庆市工业学校聂勋科
版权所有 © 2010-2015 <A href=http://www.miibeian. target=_blank></A></TD>
</TR></TBODY>
</TABLE>
</BODY>
</HTML>
总是说 line 58 : var provinceNodes = xmlDoc.documentElements.childNodes; //这一行有错误,无法获取属性“childNodes”的值: 对象为 null 或未定义