locked
Iframes issue RRS feed

  • Question

  • User78494605 posted

    I have created populated two iframes parent and child both belongs to different aspx pages i need to change the border style of parent aspx page from child but i cant able to get parent iframe id in child.i need to change parent iframe border once child iframe is opened .I need to handle this in jquery kindly tell me the solution

    Friday, March 18, 2016 11:08 AM

Answers

  • User61956409 posted

    Hi pavi90,

    You could refer to the following sample to specify a border for parent iframe.

    <div>
        Main Page
        <br />
        <iframe id="myiframe" src="ChildPage.aspx"></iframe>
    </div>
    

    ChildPage

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script>
            function myfunction() {
                parent.document.getElementById("myiframe").style.border = "1px solid #ccc";
            }
        </script>
    </head>
    <body onload="myfunction()">
        <form id="form1" runat="server">
            <div>
                I'm Child Page
            </div>
        </form>
    </body>
    </html>
    

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 21, 2016 5:02 AM