zoukankan      html  css  js  c++  java
  • 在主页面中实现Iframe中的子页面的切换

    1 在主页面中控制子页面的切换

    在主页面中的代码以及DOM

     <script type="text/javascript">

    function changeUrl(url) {

                document.getElementById("ifra_operation").src = url;

            }

     </script>

      <div id="div_operation">

                <iframe id="ifra_operation" src="A.aspx" runat="server"></iframe>

      </div>

     <input id="submit" onclick="changeUrl('B.aspx')"/>

    2 在子页面中控制另一个子页面的切换

       子页面C.aspx中

      <script type ="text/javascript" >

            function getUrl(url) {

                var anotherFrame = top.parent.document.frames["ifra_operation"];

                anotherFrame.location = url;

            }

     </script>

    <input id="submit" onclick="getUrl('B.aspx')"/>

  • 相关阅读:
    day21继承
    day22
    面向对象
    常用模块
    模块
    迭代器
    【游记】2020-CSP
    【初赛解析】2021CSP-S初赛解析(不完全)
    【题解】AcWing 1390.通电围栏
    【题解】AcWing 1387.家的范围
  • 原文地址:https://www.cnblogs.com/myparamita/p/1947675.html
Copyright © 2011-2022 走看看