我正在寫一個firefox插件。下面是引用document.forms [i] [j] .type的問題,返回undefined
var cForm = '';
var doc = document;
for (i = 0; i < doc.forms.length; i++)
{
var a = doc.forms[i].name + "";
if (a.search("itsMe") != -1)
{
cForm = i;
}
}
//
if (cForm != '')
{
for (i = 0; i < doc.forms[cForm].length; i++)
{
var sTotal = 'doc.forms[' + cForm + '][' + i +'].type';
if (eval(sTotal) == "button")
{
return sTotal ;
}
}
}
的一部分,第一個代碼工作得很好。第二個代碼顯示如下錯誤:「doc.forms [0] [0]未定義」
最新錯誤?幫助...
錯誤確實是'doc.form [0] [0]是未定義的嗎?還是它'doc.forms [0] [0]是未定義的?注意形式中的's'。 – 2011-05-28 00:21:24
哎呀!你的權利,它的* doc.forms [0] [0] .type *給出undefined :( – 2011-05-28 00:22:46
請同時發佈HTML – 2011-05-28 00:25:12