举例:
首先有个a.aspx页面以及一个b.htm页面,a页面里面有一个TextBox1控件代码如下
<asp:TextBox ID="TextBox1" runat="server" Visible="false" Text=""></asp:TextBox>
<iframe src="../b.htm" height="500" width="90%"></iframe> 我想从b.htm页面里获得a.aspx页面的TextBox1控件。
我试了下几个方法都不行
parent.document.getElementById("TextBox1").value 这个不行
window.parent.$("#LongitudeTextBox").val()通过JQ的方式也不行。
菜鸟跪求解法
首先有个a.aspx页面以及一个b.htm页面,a页面里面有一个TextBox1控件代码如下
<asp:TextBox ID="TextBox1" runat="server" Visible="false" Text=""></asp:TextBox>
<iframe src="../b.htm" height="500" width="90%"></iframe> 我想从b.htm页面里获得a.aspx页面的TextBox1控件。
我试了下几个方法都不行
parent.document.getElementById("TextBox1").value 这个不行
window.parent.$("#LongitudeTextBox").val()通过JQ的方式也不行。
菜鸟跪求解法
在页面里面就不加载,所以找不到如果既想隐藏又想通过JS找到 可以使用style="display:none"来隐藏parent.document.getElementById("TextBox1").value 这个方法没问题
谢谢jingyuanlv 这个回答是对的,Visible="false"后不能找到控件。也谢谢cuitdandan的友情回答。