简体   繁体   English

从其他iframe打开iframe中的页面

[英]open page in iframe from other iframe

I have a mainscreen with 2 iframes. 我有一个带有2个iframe的主屏幕。 In iframe named (and also id) "leftmenu" I load frmLeftMenu.php and in the second iframe named (and also id) "appscreen" I load frmAppScreen.php. 在名为(还具有ID)“ leftmenu”的iframe中,加载frmLeftMenu.php,在名为(也具有ID)“ appscreen”的第二个iframe中,加载frmAppScreen.php。

In the frmLeftMenu.php I have a tree menu (dhtmlX) and on the onclick event I want to load a page in the iframe named "appscreen". 在frmLeftMenu.php中,我有一个树菜单(dhtmlX),在onclick事件中,我想在iframe中加载一个名为“ appscreen”的页面。 The handling of the onclick is made in the frmLeftMenu.php. onclick的处理在frmLeftMenu.php中进行。

What is the best way to do this? 做这个的最好方式是什么?

I found the solutions. 我找到了解决方案。 on the onclick I execute a function named DoOnclick. 在onclick上,我执行一个名为DoOnclick的函数。 There I'm testing the id from the menu items and then execute a window.open("formname.php","appscreen"); 在那里,我正在测试菜单项的ID,然后执行window.open(“ formname.php”,“ appscreen”); This is working well for my application. 这对于我的应用程序来说效果很好。

code example: 代码示例:

        myTree.setOnClickHandler(DoOnclick);
        function DoOnclick(id){

            switch(myTree.getSelectedItemId()){
                case 'adm_users'  : window.open("frmUserMaintenance.php", "appscreen");                    
                                    break;                                   
            }

        };            

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM