2011-08-24 78 views
0

我有一個asp.net web應用程序,它使用aspx頁面中的iFrame(稱爲「fraContent」)。在iFrame中,我有一個存儲「計數器」值的隱藏字段(稱爲「hdnCounter」)。從asp.net中的iFrame獲取值

從父aspx頁面,我如何從iFrame訪問隱藏的值?

alert(document.getElementById('window.fraContent.hdnCounter').value);似乎不起作用

回答

2

元素的ID是不window.fraContent.hdnCounter,所以getElementById將無法​​正常工作。

您只需要:alert(window.fraContent.document.getElementById('hdnCounter').value)