Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.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 使用另一个网页中的按钮更改一个网页中的div_Javascript_Jquery_Html_Ajax - Fatal编程技术网

Javascript 使用另一个网页中的按钮更改一个网页中的div

Javascript 使用另一个网页中的按钮更改一个网页中的div,javascript,jquery,html,ajax,Javascript,Jquery,Html,Ajax,我有两个网页:一个像电视,另一个像遥控器 这是电视 <!DOCTYPE html> <html> <head> <title>Welcome to RemoteDemo</title> </head> <body> <div id="Tvspace"> <iframe width="560" height="315" src="SomeRa

我有两个网页:一个像电视,另一个像遥控器

这是电视

<!DOCTYPE html>
<html>
    <head>
        <title>Welcome to RemoteDemo</title>
    </head>
<body>
    <div id="Tvspace">
        <iframe width="560" height="315" src="SomeRandomYoutubeURL" frameborder="0"  allowfullscreen></iframe>      
    </div>
</body>
</html>
我希望它在不刷新或创建新页面的情况下加载内容。谢谢。

他们在信中说:

window.location对象可用于获取当前页面地址 URL和以将浏览器重定向到新页面

因此,不能使用窗口位置加载iframe。您可以使用它获取页面的url,并将其设置为重定向到其他页面

如果选中此项,您可以找到一种方法,用另一个url加载iframe:

$("#next").on('click', function(){
    $("#Tvspace iframe").attr("src", "http://www.google.com/");
});

这两页到底有什么关系?从你的问题中我只能看到两页,其中一页包含一个iframe。它们在同一个文件夹@Taplar中
$("#next").on('click', function(){
     window.location = "http://www.google.com/";    
});
$("#next").on('click', function(){
    $("#Tvspace iframe").attr("src", "http://www.google.com/");
});