IE和Firefox,关于onchange()的问题!

lao_tou 2009-04-20 01:53:46
function Change_Select(selectValue,target,str)
{
if(selectValue.value==-2){
document.userForm("teamVO.tname").value="";
selectValue.value=-1;
document.userForm.submit();
}else{
var strUrl;
//查询城市list
if(target=='teamVO.cityId')
{
strUrl="pubAction.do?oper=searchArea&areaVO.superId="+selectValue.value;
}
else
{
if(selectValue.value=="-1")
document.userForm.elements(target).style.display ="none";
else
document.userForm.elements(target).style.display ="";
strUrl="pubAction.do?oper=searchTeamType&teamTypeVO.superid="+selectValue.value;
}
if(window.XMLHttpRequest)
{
req=new XMLHttpRequest();
}else if(window.ActiveXObject)
{
req=new ActiveXObject("Microsoft.XMLHTTP");
}
if(req)
{
req.open("GET",strUrl,true);
req.onreadystatechange=function()
{
if(req.readyState == 4)
{
if(req.status == 200)
{
parseMessage(selectValue.value,target,str);
}
else
{
alert("Not able to retrieve description"+req.statusText);
}
}
}
req.send(null);
}
}
}


<html:select name="userForm" property="teamVO.typeId" onchange="Change_Select(this,'teamVO.subTypeId','--请选择子类别--')" styleClass="input_re">
<html:option value="-1">--请选择类别--</html:option>
<html:option value="-2">全部</html:option>
<logic:present name="userForm" property="teamTypeVOList">
<html:optionsCollection name="userForm" property="teamTypeVOList" value="typeId" label="typeName"/>
</logic:present>
</html:select></td>
<td width="110">
<html:select name="userForm" property="teamVO.subTypeId" style="display:none" styleClass="input_re">
<html:option value="-1">--请选择子类别--</html:option>
</html:select>

选择一个下拉列表,调用onchange(),弹出一个子拉列表。
IE显示正确,Firefox不显示子下拉列表。
...全文
314 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jfismylove 2011-10-26
  • 打赏
  • 举报
回复
真垃圾,什么破回复也登陆后查看!我太阳!
sohighthesky 2009-04-20
  • 打赏
  • 举报
回复
在FF下看这个document.userForm("teamVO.tname")弹出来是不是空对象

81,091

社区成员

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

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