Struts标签和javascript的问题,请高手帮忙
javascript代码:
function ChkPersonal_onclick() {
if ( ChkPersonal.checked )
{
TxtPersonName.style.display = " ";
CboOrgan.style.display = "none ";
}
else
{
TxtPersonName.style.display = "none ";
CboOrgan.style.display = " ";
}
}
Struts标签:
<html:select styleClass= "ComboStyle " styleId= "CboOrgan " style= "WIDTH: 50% " property= "infoSourceName ">
<html:options collection= "infoSourceList " property= "infoSourceName " labelProperty= "infoSourceName " />
</html:select>
<html:text styleClass= "TxtStyle " styleId= "TxtPersonName " style= "DISPLAY: none; WIDTH: 50% " property= "infoSourceName " />
<INPUT id= "ChkPersonal " onclick= "return ChkPersonal_onclick() " type= "checkbox " name= "ChkPersonal "> 个人发布
问题:我想点击 "个人发布 "后让 "html:select "的内容隐藏,但是javascript代码不能执行,请高手帮忙看看那个地方错了!
在线等,谢谢.
------解决方案--------------------把styleId= "CboOrgan " 改为Id= "CboOrgan " 试试
------解决方案--------------------个人一点偷懒的小建议,能不能不去试图直接操作你的select标签。因为那样通过寻找id的形式定位的确很麻烦。如果可以,尝试在select的外面嵌套一层div层,然后给div层一个id。这样display属性你就直接控制div层,可好?
------解决方案--------------------套了div就和ChkPersonal无关了,用id= "Oo "
------解决方案--------------------你可以试一下,if ( ChkPersonal.selected==checked )
------解决方案--------------------用DIV 肯定可以
我觉得还可以用标签的rendered属性