<iframe src="http://www.w3schools.com" name="isfsf">
</iframe>
<script>
window.setInterval("reloadIFrame();", 3000);
function reloadIFrame() {
document.frames["isfsf"].location.reload();
}
</script>
自动刷新的iframe不工作?请帮我
<iframe src="http://www.w3schools.com" name="isfsf">
</iframe>
<script>
window.setInterval("reloadIFrame();", 3000);
function reloadIFrame() {
document.frames["isfsf"].location.reload();
}
</script>
自动刷新的iframe不工作?请帮我
试试这个:
function refresh()
{
var iframe = document.getElementById('iframe');
iframe.reload(true);
}
setTimeout('refresh()', 3000);
试试这个
document.getElementById('isfsf').contentWindow.location.reload();
或
document.getElementById('isfsf').src = document.getElementById('isfsf').src;
试试这个。为了在代码之下工作,不要忘记包含jquery库。 其将刷新iframe标签以每3秒
$(document).ready(function() {
setInterval(function(){
var url=$('iframe').attr('src');
$('iframe').attr('src',url);
},3000);
});
尽量做到:
window.setInterval(function(){ reloadIFrame() },3000);
function reloadIFrame() {
document.getElementById('isfsf').contentWindow.location.reload();
}
更改window.setInterval( “reloadIFrame();”,3000); to window.setInterval(function(){reloadIFrame();},3000); – Koti