关于参数的传递........

balinghousheng 2008-07-30 10:33:56
这是我的XML文件内容:
<?xml version="1.0" encoding="ISO-8859-1"?>
<CATALOG>
<HOUSE>
<DISTRICT>yantian</DISTRICT>
<NAME>lanhuahu</NAME>
<DEVELOPER>jinke</DEVELOPER>
<NUMBER>20750</NUMBER>
</HOUSE>
<HOUSE>
<DISTRICT>nanshan</DISTRICT>
<NAME>kekexili</NAME>
<DEVELOPER>longhu</DEVELOPER>
<NUMBER>21590</NUMBER>
</HOUSE>
<HOUSE>
<DISTRICT>nanshan</DISTRICT>
<NAME>gaoshanhuayuan</NAME>
<DEVELOPER>longhu</DEVELOPER>
<NUMBER>26205</NUMBER>
</HOUSE>
<HOUSE>
<DISTRICT>yantian</DISTRICT>
<NAME>fengjingwuxian</NAME>
<DEVELOPER>longhu</DEVELOPER>
<NUMBER>20100</NUMBER>
</HOUSE>
<HOUSE>
<DISTRICT>baoan</DISTRICT>
<NAME>shencaifeiyang</NAME>
<DEVELOPER>longhu</DEVELOPER>
<NUMBER>20400</NUMBER>
</HOUSE>
<HOUSE>
<DISTRICT>yantian</DISTRICT>
<NAME>caihuhuayuan</NAME>
<DEVELOPER>yongyou</DEVELOPER>
<NUMBER>20300</NUMBER>
</HOUSE>
</CATALOG>
HTML文件内容:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
function changPage(data,url)
{
if(data.options[data.selectedIndex].value!= "")
{
window.open("http://www."+url);
}
}
function getlist(area,type)
{
var xmlDoc=null;
if (window.ActiveXObject)
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");

}
else if (document.implementation.createDocument)
{
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}

if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("catalog.xml");
document.write("<form>");
var x=xmlDoc.getElementsByTagName("HOUSE");
var area;
var type;
document.write("<select name='楼盘名' size='type'
onchange=changPage(this,"szhome.com/"+this.options[this.selectedIndex].value)>");
document.write("<option>--选择--");
for (i=0;i<x.length;i++)
{
if(x[i].getElementsByTagName("DISTRICT")[0].childNodes[0].nodeValue==area)
{
document.write("<option value='x[i].getElementsByTagName("NUMBER")[0].childNodes[0].nodeValue'>");
document.write(x[i].getElementsByTagName("NAME")[0].childNodes[0].nodeValue);
}
}
document.write("</select>");
}
document.write("<form>")
}
</script>

</head>

<body>
<script type="text/javascript">window.onload=getlist("baoan","");
</script>
<br><br>
<script type="text/javascript">window.onload=getlist("nanshan","");
</script>
<br><br>
<script type="text/javascript">window.onload=getlist("yantian","");
</script>

</body>
</html>
怎么运行不起呢?参数传递有错误吗?还请高手多多指教.......
...全文
20 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧