直接上代码:
实现三个子页面同时刷新页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <iframe id="ifr" width=400 height=500></iframe> <iframe id="ifr2" width=400 height=500></iframe> <iframe id="ifr3" width=400 height=500></iframe> <div id='count' width=30 height=30 style="background:red; font-size:30"></div> <script type="text/javascript"> url = new Array(); url[0] = "http://blog.csdn.net/youacai/article/details/6644023"; url[1] = "http://blog.csdn.net/youacai/article/details/6717063"; url[2] = "http://blog.csdn.net/youacai/article/details/6588057"; url[3] = "http://blog.csdn.net/youacai/article/details/6707787"; url[4] = "http://blog.csdn.net/youacai/article/details/6646634"; url[5] = "http://blog.csdn.net/youacai/article/details/6705466"; url[6] = "http://blog.csdn.net/youacai/article/details/6651285"; url[7] = "http://blog.csdn.net/youacai/article/details/6681695"; url[8] = "http://blog.csdn.net/youacai/article/details/6708574"; url[9] = "http://blog.csdn.net/youacai"; url[10] = "http://blog.csdn.net/youacai/article/details/6717063"; var n = 1; window.setInterval(function(){ i = Math.random() * url.length; j = Math.floor(i); k = parseInt(10*Math.random());//随机取0-10的整数 m = parseInt(10*Math.random()+1);//随机取1-10的整数 n++; //alert(n); document.getElementById("ifr").src=url[j]; document.getElementById("ifr2").src=url[k]; document.getElementById("ifr3").src=url[m]; document.getElementById("count").innerHTML = n; },10000) //这里的10000等于10000毫秒 也就是10秒 window.setInterval(function(){ k = parseInt(10*Math.random());//随机取0-10的整数 document.getElementById("ifr3").src=url[k]; document.getElementById("ifr2").src="http://blog.csdn.net/youacai"; document.getElementById("ifr").src="http://blog.csdn.net/youacai"; },20000) //这里的10000等于10000毫秒 也就是10秒 </script> </body> </html>