代码:
<html> <head> <title> hello world </title> </head> <body> <script language="JavaScript"> function myrefresh() { window.location.reload(); } setTimeout('myrefresh()',8000); </script> <div id="testloadimg"> </div> <script type="text/javascript"> var arr = ["https://sy.ytecn.com/"]; function timedCount() { var content = ""; for (var i = 0; i < arr.length; i++) { content += "<img src=\""+arr[i]+"?r=" + Math.random() + "\" />"; } document.getElementById("testloadimg").innerHTML = content; setTimeout("timedCount()", 20000); } timedCount(); </script> </body> </html>
在arr里面添加所需要刷新的网站。