iframe with aspx page makes page stop rendering

落花浮王杯 提交于 2020-01-16 19:04:08

问题


I have an iFrame inside my index page. This iFrame contains an aspx page with a form inside it, with runat=server.

For some weird reason, anything I add after the iFrame is not being rendered to the page.

I tried adding text, a div, nothing is being added after when I run the page.

Code:

<body>

        <asp:Panel ID="Panel1" runat="server" Height="80px">
        <iframe name="LogoFrame" id="LogoFrame" src="asp/Logo.aspx" 
            scrolling="no" 
            style="border-style: hidden; padding: 0px; margin: 00px; width: 100%; height: 100%" 
            width="100%"/>
        </asp:Panel>

        <form id="MainMenu" method="post" runat="server">

        <asp:Panel ID="Panel2" runat="server" Height="38px">

            <table class="tableMenu" id="MainTable" style="BACKGROUND-COLOR: #e2eded" cellSpacing="0"
                cellPadding="0" width="100%" border="0">
                <tr class="trMenu2" vAlign="middle">

        // Some other things below, including the closing of Panel2 and MainMenu form

When I run and inspect the page...

If I remove the iFrame, the rest of the page renders properly.
What is up with that?


回答1:


I suspect it's because the iframe tag is self-closing and iframes should not be self-closing. If you replace ' />' with '></iframe>', I think that should resolve the problem.




回答2:


Seems like the iframe is out of the form tag. But you put the iframe inside a Panel, which is an asp.net tool. You can try Removing the panel, or moving the code inside the form tags.



来源:https://stackoverflow.com/questions/37140788/iframe-with-aspx-page-makes-page-stop-rendering

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!