我有2个网页:一个像电视,另一个像遥控器。
这是电视
<!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>
这是遥控器:
<!DOCTYPE html>
<html>
<head>
<title>Remote</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<!--Click this to go on the next channel -->
<button id = "next"> Next </button>
</body>
</html>
每当我点击下一个/上一个按钮时,我想要另一个iframe加载div名称“Tvspace”而不是原始。
我尝试了这个,但它正在打开一个新的页面
$("#next").on('click', function(){
window.location = "http://www.google.com/";
});
我希望它在不刷新或创建新页面的情况下加载内容。谢谢。