Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.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
Javascript 将一个Iframe的内容嵌入到另一个Iframe_Javascript_Html_Iframe_Src - Fatal编程技术网

Javascript 将一个Iframe的内容嵌入到另一个Iframe

Javascript 将一个Iframe的内容嵌入到另一个Iframe,javascript,html,iframe,src,Javascript,Html,Iframe,Src,我有一个index.html文件和一个外部js中的函数(无法修改) 提供以下输出的文件 return iframe.contentWindow.document.getElementById('Video'); 请注意,上面代码中使用的iframe不在index.html文件中,我正在处理两个不同的iframe 我想使用这个函数的返回值getVideo()作为index.html上的另一个iframe(id=“myFrame”)的内容 我已经尝试了下面的代码,但它没有显示预期的结果 var

我有一个index.html文件和一个外部js中的函数(无法修改) 提供以下输出的文件

 return iframe.contentWindow.document.getElementById('Video');
请注意,上面代码中使用的iframe不在index.html文件中,我正在处理两个不同的iframe

我想使用这个函数的返回值getVideo()作为index.html上的另一个iframe(id=“myFrame”)的内容

我已经尝试了下面的代码,但它没有显示预期的结果

var result = getVideo();
document.getElementById('myFrame').src = result; 

任何建议都会很有帮助-解决方案不必是Iframe,因为目标是能够以某种方式在index.html文件上显示该函数的返回值-

要使代码正常工作,getVideo函数应该返回url。您能否更改外部js文件以返回类似
return iframe.contentWindow.document.getElementById('Video').src的内容?或者你根本无法访问它?不幸的是,无法访问该文件-在某种程度上,我需要在index.html上显示该文件的返回值-不必是iframe,但这是我的首选