日期:2014-05-16  浏览次数:20361 次

火狐不能用javascript的问题
<script   language= "javascript ">
function   changeform(e)
{
if(e   ==   0)
{
a1.style.display   =   " ";
a2.style.display   =   "none ";
}
if(e   ==   1)
{
a1.style.display   =   "none ";
a2.style.display   =   " ";
}
}
</script>
<input   type= "radio "   name= "a "   value= "0 "   onclick= "changeform(this.value); "   />
<input   type= "radio "   name= "a "   value= "1 "   onclick= "changeform(this.value); "   />
<div   id= "a1 ">
a1a1a1a1a1
</div>
<div   id= "a2 "   style= "display:none ">
a2a2a2a2a2
</div>


这个在火狐下不能用啊     求助

------解决方案--------------------
我试了一下,可以用的啊。
楼主查看一下设置,是否允许运行javascript
------解决方案--------------------
你传递一个this也可以啊
在js中判断
this.value == 1
最好把字符串转化为数字,paserInt(this.value)
------解决方案--------------------
晕,用document.getElementById()取一下ID,不然火狐可能会报undefine,具体看一下,火狐的工具下的javascript控制台