2011-08-24 75 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)