怎么用js改变iframe 的多个地址
<scripttype="text/javascript">functionvideo(Url){document.frames[0].location.href=Url...
<script type="text/javascript">
function video(Url)
{
document.frames[0].location.href =Url;
}
</script>
<iframe id="video" frameborder="0" width="878" height="580" src="" allowfullscreen></iframe>
<a onclick="video('xxx.html')" href="#">1</a>
<a onclick="video('bbb.html')" href="#">2</a>
这个的代码实现不了点击1就跳转到xxx'.html,点击2跳转到bbb.html,请问如何实现。 展开
function video(Url)
{
document.frames[0].location.href =Url;
}
</script>
<iframe id="video" frameborder="0" width="878" height="580" src="" allowfullscreen></iframe>
<a onclick="video('xxx.html')" href="#">1</a>
<a onclick="video('bbb.html')" href="#">2</a>
这个的代码实现不了点击1就跳转到xxx'.html,点击2跳转到bbb.html,请问如何实现。 展开
展开全部
<html>
<head></head>
<body>
<iframe id="video" frameborder="0" width="878" height="580" src="" allowfullscreen></iframe>
<a onclick="video('aaa.html')" href="#">1</a>
<a onclick="video('bbb.html')" href="#">2</a>
<script>
function video(abs){
var $str=document.getElementById('video');
$str.src=abs;
}
</script>
</body>
</html>
<head></head>
<body>
<iframe id="video" frameborder="0" width="878" height="580" src="" allowfullscreen></iframe>
<a onclick="video('aaa.html')" href="#">1</a>
<a onclick="video('bbb.html')" href="#">2</a>
<script>
function video(abs){
var $str=document.getElementById('video');
$str.src=abs;
}
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询