Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/395.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_Php_Jquery_Html_Iframe - Fatal编程技术网

使用Javascript刷新Iframe中的Iframe

使用Javascript刷新Iframe中的Iframe,javascript,php,jquery,html,iframe,Javascript,Php,Jquery,Html,Iframe,我有以下几点 1页MainWindow.php中的2个iFrame php是我的内容页 下面的代码是针对page2.php的 <!DOCTYPE html> <html lang="en"> <head> <script type="text/javascript"> document.getElementById('iframe1').src = document.getElementById('iframeA').src </script

我有以下几点

1页MainWindow.php中的2个iFrame

php是我的内容页

下面的代码是针对page2.php的

<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
document.getElementById('iframe1').src = document.getElementById('iframeA').src
</script></head>
<body>
</body>
</html>

当iframeB上的页面更改为页面上的上述javascript代码时,比如reload.php,它不会重新加载iframeA,什么都不会发生,检查元素并且没有javascript错误。

name=iframeA应该是id=iframeA,如果您计划使用getElementById作为选择器。请阅读,这里有很多信息,如何跨iFrame引用。您看到了吗?我认为你的问题有误导性。本质上,您只是尝试更新DOM中的iframe,这个问题回答了如何进行更新。如果它是跨域的,则某些帧将不允许与开放帧通信。
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
document.getElementById('iframe1').src = document.getElementById('iframeA').src
</script></head>
<body>
</body>
</html>