首页 > 代码库 > 网页测速,以及定时刷新
网页测速,以及定时刷新
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>网页测速,以及定时刷新</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script src="http://www.mamicode.com/jquery-1.9.1.js" /></script>
<script type="text/javascript">
//定时两秒刷新一次
setInterval(‘sub()‘,2000);
function sub(){
$("#sub").click();
}
</script>
</head>
<body>
<a href=""></a>
测试网站连接速度:
<script language="javascript">
tim=1
setInterval("tim++",100)
b=1
var autourl=new Array()
autourl[1]="www.baidu.com"
autourl[2]="www.sina.com"
autourl[3]="www.qq.com"
function butt(){
document.write("<form name=autof>")
for(var i=1;i<autourl.length;i++)document.write("<input type=text name=txt"+i+" size=10 value=http://www.mamicode.com/测试中……> =》document.write("<input type=submit id=‘sub‘ value=http://www.mamicode.com/刷新>")
}
butt()
function auto(url){
document.forms[0]["url"+b].value=http://www.mamicode.com/url
if(tim>200)
{document.forms[0]["txt"+b].value="http://www.mamicode.com/链接超时"}
else
{document.forms[0]["txt"+b].value="http://www.mamicode.com/时间"+tim/10+"秒"}
b++
}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 one rror=auto(‘http://"+autourl[i]+"‘)>")}
run()
</script>
</body>
</html>
")document.write("")}butt()function auto(url){document.forms[0]["url"+b].value=http://www.mamicode.com/url>200){document.forms[0]["txt"+b].value="http://www.mamicode.com/链接超时"}else{document.forms[0]["txt"+b].value="http://www.mamicode.com/时间"+tim/10+"秒"}b++}function run(){for(var i=1;i")}run()// ]]></script>
网页测速,以及定时刷新