网速测试
<div style="line-height: 180%" align=left><p>代码存为speedtest.asp,同目录下放一个大约100k的img.jpg图片,具体大小请改代码中的<font class=hightlight>var fs = 137.57//img.jpg文件大小(k)</font></p>
<p><a href="http://www.51windows.net/asp_samples/speedtest.asp" target=_blank><font color=#0000ff>查看演示</font></a></p>
<p><textarea style="width: 100%; height: 300px" name=code rows=20 cols=72><html>
<head>
<title>网站速度测试-51windows.net</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta name="author" content="51windows,海娃,haiwa">
<meta name="description" content="power by 51windows.net">
</head>
<body>
<%
response.expires=-1
response.expiresabsolute=now()-1
response.cachecontrol="no-cache"
dim imgrandom
randomize
imgrandom = int(799999 * rnd + 200000)
%>
<script language="javascript">
window.status = "下载数据中..."
var st = new date()
</script>
<img src="img.jpg?id=<%=imgrandom%>" width=0 height=0 onerror = showerr() onload="showspeed();">
<script language="javascript">
//海娃(51windows.net)
function showspeed()
{
var fs = 137.57 //img.jpg文件大小(k)
var l = 2 //小数点的位数
var et = new date()
alltime = fs*1000/(et - st)
lnum = math.pow(10,l)
calcspeed = math.round(alltime*lnum)/lnum
showtxt.innerhtml = ("服务器时间为:<%=now%>,您在本站的下载速度为:"+calcspeed+" (k/秒)")
window.status = "您在本站的下载速度为:"+calcspeed+" (k/秒)"
}
function showerr()
{
showtxt.innerhtml = ("数据下载错误,请刷新重试")
window.status = "数据下载错误,请刷新重试"
}
</script>
<button style="font-size:12px;width:80;height:19px;" onclick=location.href="speedtest.asp?<%=imgrandom%>">重新测试</button>
<span id=showtxt></span>
</body>
</html>
</textarea></p></div>
<hr size=1>
<span id=actzone><input onclick=sendmail() type=button value=推荐本页给您的朋友!> <input onclick=copyurl() type=button value=复制本页地址></span> [EM02]
页:
[1]