Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.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
iframe src在Django中单击按钮时未更改_Django_Html_Iframe - Fatal编程技术网

iframe src在Django中单击按钮时未更改

iframe src在Django中单击按钮时未更改,django,html,iframe,Django,Html,Iframe,在我的网页中,我使用iframe src中Geoexplorer发布的地图。单击按钮,我想在同一iframe中加载另一个服务,但它不工作。 我在map.html中的html代码是 <!DOCTYPE html> <html> <head> </head> <body> <nav> <button type="button" onclick="go()">Actual plant functional type

在我的网页中,我使用iframe src中Geoexplorer发布的地图。单击按钮,我想在同一iframe中加载另一个服务,但它不工作。 我在map.html中的html代码是

<!DOCTYPE html>
<html>
<head>
</head>
<body>

<nav>
 <button type="button" onclick="go()">Actual plant functional type</button> 
</nav>

<section>
<iframe  id="test" style="border: none;" height="494" width="1100"  src="http://localhost:8080/geoexplorer/viewer/#maps/1"></iframe>
</section>

<script type="text/javascript">
function go() {
    document.getElementById("test").src = "http://localhost:8080/geoexplorer/viewer/#maps/2";
}
</script>

</body>
</html>

实际设备功能类型
函数go(){
document.getElementById(“test”).src=”http://localhost:8080/geoexplorer/viewer/#maps/2";
}

我找不到您的代码有问题。是的。我无法找出问题所在。你跑步时会发生什么?您是否仔细检查了第二张地图的路径是否存在?您是否使用了
console.log
来检查
go()
函数正在启动?当我包含其他url时,会启动Yes go()函数。我甚至核对了第二张地图。当我在浏览器中加载它时,它会工作。我一直在想:(URL的内容是什么?我认为第二个映射可能太大了?我已经用虚拟图像在本地测试了你的代码,它工作得非常好。