2012-03-07 24 views
0

我有有單選按鈕,選擇的值取一個函數內部像在找不到window.document.forms [0]

function returnSelect() 
{ 
    window.document.forms[0].choice_processType.value ; 
    window.opener.document.forms[0].pevent.value = 'getpNames'; 
    window.opener.document.forms[0].processName.value=''; 
    for (var i=0; i < document.forms[0].elements.length; i++) 
    { 
    if (document.forms[0].elements[i].checked) 
     { 
     window.opener.document.forms[0].processName.value=document.forms[0].elements[i].value; 
     break; 
     } 
    } 
    if(window.opener.document.forms[0].processName.value=='') { 
     window.opener.document.forms[0].pevent.value = ''; 
    } 
    window.opener.document.forms[0].submit(); 
    closeConn(); 
} 

所以在這裏,當我使用Firebug一個頁面,窗口元素.document.forms [0]沒有processName或pevent等(它爲空)

如何調試此問題?

+0

這與Firebug有什麼關係?問題是要處理'window.document.forms [0]';沒有看到正確的測試用例,除了強調不使用'document.forms'這個問題之外,很難提供幫助(做一些類似於通過ID獲取元素的方法)。 – 2012-03-07 05:54:27

+0

我有興趣使用螢火蟲來調試這個問題,這段代碼是我們公司的,並且已經存在很長時間了。現在它不工作,我需要調試 – siva 2012-03-07 06:05:30

+0

所以我只是想在螢火蟲調試這個問題欣賞你解決相同的輸入 – siva 2012-03-07 06:06:08

回答

0

使用parent.wndow.document它的工作原理