Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用jquery从iframe加载div中的内容_Jquery_Html_Iframe_Load_External - Fatal编程技术网

使用jquery从iframe加载div中的内容

使用jquery从iframe加载div中的内容,jquery,html,iframe,load,external,Jquery,Html,Iframe,Load,External,在我的“index.php”页面中有一个下拉列表菜单,可以在iframe中加载另一个页面(取决于选择),如下所示: 函数setPic(elem){ var image=document.getElementById('canvas'); image.src=元素值; } 装货区 1级 lvl2 lvl3 lvl4 您必须访问父窗口的DOM,因为javascript是在一个框架内执行的 window.opener.$("#header") 最终得到了: 我这样更改jquery以访问父窗口:

在我的“index.php”页面中有一个下拉列表菜单,可以在iframe中加载另一个页面(取决于选择),如下所示:


函数setPic(elem){
var image=document.getElementById('canvas');
image.src=元素值;
}
装货区
1级
lvl2
lvl3
lvl4

您必须访问父窗口的DOM,因为javascript是在一个框架内执行的

window.opener.$("#header")

最终得到了:

我这样更改jquery以访问父窗口:


$(“#header”,window.parent.document).load('/network/buttons/'+page+'.php')$('input')改为使用$('A1')。单击将有更多按钮…A1只是一个示例…因此我不能仅针对此按钮使用它。我修改jquery如下:$(document).ready(function(){window.opener.$('header').load('network/page\u elements/header.php');$('input')。单击(function(){var page=$(this).attr('id'));window.opener.$('#header').load('network/buttons/'+page+'.php');});返回false;});但它仍然不起作用。