我的代码
<iframe src="http://www.w3schools.com" name="isfsf">
</iframe>
<script>
window.setInterval("reloadIFrame();", 3000);
function reloadIFrame() {
document.frames["isfsf"].location.reload();
}
</script>
自动刷新 iframe 不起作用?请帮助我
最佳答案
试试这个。对于下面的代码,不要忘记包含 jquery 库。 它会每 3 秒刷新一次 iframe 标签
$(document).ready(function() {
setInterval(function(){
var url=$('iframe').attr('src');
$('iframe').attr('src',url);
},3000);
});
关于javascript - 自动刷新 iframe 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22344368/