---
title: "asp带进度条测网速代码"
author: "fengxu"
date: "2008-07-18T15:56:00Z"
tags: ["ASP", "Cache", "HTML", "JavaScript"]
slug: "asp"
draft: false
lastmod: "2008-07-18T15:56:00Z"
id: 343534
url: "https://fengxu.iteye.com/blog/343534"
---

&lt;%  
Response.Expires = 0  
Response.Expiresabsolute = Now() - 1  
Response.AddHeader "pragma","no-cache"  
Response.AddHeader "cache-control","private"  
Response.CacheControl = "no-cache"  
%&gt;&lt;html&gt;  
&lt;head&gt;  
&lt;title&gt;网速测试&lt;/title&gt;  
&lt;meta http-equiv="content-type" content="text/html; charset=gb2312"&gt;  
&lt;body style="cursor:wait;"&gt;  
&lt;p style="font-size:18pt;"&gt;&lt;B&gt;网速测试&lt;/B&gt;&lt;/p&gt;  
&lt;p id="t" style="font-size:16pt;"&gt;正在测试，请稍候...&lt;/p&gt;  
&lt;span style="width:300;height:16px;background-color:gray;"&gt;&lt;span id="p" style="width:0;height:16px;background-color:red;"&gt;&lt;/span&gt;&lt;/span&gt;  
&lt;script language="javascript"&gt;st = new Date();function $(p){document.getElementById("t").innerHTML="正在测试，请稍候...("+p+"%)";document.getElementById("p").style.width=p\*3;}&lt;/script&gt;  
&lt;%  
defaultfs = 200 '数据默认大小(K)  
minfs = 100 '数据最小值  
maxfs = 500 '数据最高值  
fs = Request("s")  
if len(fs) = 0 or isnumeric(fs) = false then fs = defaultfs  
if int(fs) &gt; maxfs then fs = maxfs  
if int(fs) &lt; minfs then fs = minfs  
for a=1 to fs%&gt;&lt;!--$%^)!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()!@#$%^&\*()--&gt;&lt;script language=javascript&gt;$(&lt;%=int(a\*100/fs)%&gt;)&lt;/script&gt;&lt;%next%&gt;  
&lt;script language=javascript&gt;  
et=new Date();ds=&lt;%=fs%&gt;;s=Math.round(ds\*1000/(et-st)\*10)/10;document.body.style.cursor='default';  
nextsize=&lt;%=fs%&gt;;if(s&gt;100){nextsize=&lt;%=maxfs%&gt;;}else if(s&lt;20){nextsize=&lt;%=minfs%&gt;;}  
document.getElementById("t").innerHTML="测试完毕。您的速度：&lt;font color='red'&gt;"+s+"&lt;/font&gt;(K/秒) \[&lt;a href='?s="+nextsize+"&t="+Math.random()+"'&gt;重测&lt;/a&gt;]";&lt;/script&gt;  
&lt;/body&gt;  
&lt;/html&gt;