我的代码
<iframe src="http://www.w3schools.com" name="isfsf">
</iframe>
<script>
window.setInterval("reloadIFrame();", 3000);
function reloadIFrame() {
document.frames["isfsf"].location.reload();
}
</script>
自动刷新iframe无效?请帮帮我
答案 0 :(得分:1)
试试这个。对于下面的代码工作,请不要忘记包含jquery库。 它将每3秒刷新一次iframe标记
$(document).ready(function() {
setInterval(function(){
var url=$('iframe').attr('src');
$('iframe').attr('src',url);
},3000);
});
答案 1 :(得分:1)
尝试:
window.setInterval(function(){ reloadIFrame() },3000);
function reloadIFrame() {
document.getElementById('isfsf').contentWindow.location.reload();
}
答案 2 :(得分:0)
试试这个:
function refresh()
{
var iframe = document.getElementById('iframe');
iframe.reload(true);
}
setTimeout('refresh()', 3000);
答案 3 :(得分:0)
试试这个
document.getElementById('isfsf').contentWindow.location.reload();
或
document.getElementById('isfsf').src = document.getElementById('isfsf').src;