【问题标题】:Change iframe size after clicking a content inside an iframe in jquery在 jquery 中单击 iframe 内的内容后更改 iframe 大小
【发布时间】:2015-03-22 04:35:59
【问题描述】:

大家好,我正在尝试制作一个用户必须从另一个网站登录的网站,并且该部分位于 iframe 上。我想要的是当用户单击Login 按钮时,iframe 将自行调整大小以仅查看该网站的特定内容。这是我的代码,

<div id="reportframe" style="margin: auto;">
        <iframe src="http://www.abcdsebroker.com/login" width="600" height="400"></iframe>
</div>

这是其他网站登录按钮的asp.net webform代码,

<div class="control-group text-center">
    <asp:Button ID="btnLogin" runat="server" Height="35px" Width="50%" Font-Bold="true" Text="Login" CssClass="btn btn-info" OnClick="btnlogin_Click" />
</div>

如何在使用 jQuery 单击登录按钮后更改 iframe 的大小?你的帮助将是非常可观的。 Tnx。

【问题讨论】:

    标签: javascript jquery html asp.net iframe


    【解决方案1】:

    为 iframe 设置 ID。

         <div id="reportframe" style="margin: auto;">
                        <iframe id="ifreportframe" src="http://www.abcdsebroker.com/login" width="600" height="400"></iframe>
                </div> 
                <asp:Button ID="btnLogin" runat="server" Height="35px" Width="50%" Font-Bold="true" Text="Login" CssClass="btn btn-info" OnClick="btnlogin_Click"  onClientClick="resizeIframe()"/>
    
                <script>
                 function resizeIframe()
                {
                  $("#ifreportframe").css("height","500px");
                  $("#ifreportframe").css("width","700px")
                }
                </script>
    

    【讨论】:

    • Login 按钮来自另一个网站,resizeIframe() 将在我的网站脚本中工作吗?
    猜你喜欢
    • 2014-12-28
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    • 2014-12-25
    • 2015-08-12
    • 2015-01-12
    • 2018-12-21
    • 2013-01-29
    相关资源
    最近更新 更多