【发布时间】:2011-12-28 06:13:10
【问题描述】:
我不太熟悉如何调试此类问题。在我的 HTML 中,假设我有一个表单:
<form name="myForm" >
<table>
<tr>
<td>
<input type="radio" name="myType" value="val" onclick="someFunc(this.value)"checked > stuff here
<input type="radio" name="myType" value="val2" onclick="someFunc(this.value)"> stuff2 here
</td>
..
</form>
在 Javascript 代码中,我通过以下方式引用它:
myForm.myType[0].checked
在 IE 中可以正常工作,但在 Firefox 中不行。在 Firefox 中我尝试过:
alert (myForm)
还有:
if (frmDateType == null)
{
alert('null!');
}
else
{
alert('not null!');
}
然而,在这两种情况下,Firefox 甚至都不显示警报,它基本上什么都不做,尽管在 IE 中很好。我已经安装了 Firebug,它没有显示任何错误(或者至少我找不到它们)。所以我不确定如何调试这样的问题,为什么我没有看到任何错误以及为什么 Firefox 不喜欢 MyForm?有小费吗?
【问题讨论】:
-
你试过使用getElementById函数吗?不过,您必须将 name 属性更改为 id。
标签: javascript html forms firefox html-table