好家伙 铁门栓 几集:一个困惑我很久的js问题

来源:百度文库 编辑:神马品牌网 时间:2024/05/04 14:59:56
alert(document.forms.form1.select1.value);
这句话在一新建的页中是完全正确的,可是加到我需要的地方就报document.forms.form1.select1.value为空或不是对象。
以下是整个代码:
<%set rspro=oblog.execute("select id,classname from [oblog_userarea] where parentid=0") %>
<form name="ws" method="post" action="admin_user.asp">
<select id="province" name="province" onchange="changeChildList(this,document.all['city']);" >
<option value="0">省份</option>
<%
do while not rspro.eof
response.Write("<option value='"&rspro("id")&"'>")
response.Write(rspro("classname"))
response.Write("</option>")
rspro.movenext
loop
rspro.close
set rspro=nothing
%>
</select>

js:
function changeChildList(parentObj,childObj)
{
var count=childObj.options.length;

if (count>0){childObj.length=0}
var ID=parentObj.value;
//建立跨浏览器的XMLHttpRequest对象
var xmlhttp;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
alert(document.forms.ws.province.value);
}
请各位高手帮忙看看

document.forms.ws.select1.value