网页测速

tianyang1013 2005-03-04 12:21:46
我最近再写一个网站,有关软件下载的,我希望能让每个用户在线测试自己的网速和下载速度,请问大侠们这样的ASP网页怎么写?希望有原代码能让我参考,谢谢!!!!
...全文
1401 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
德仔 2005-03-04
  • 打赏
  • 举报
回复







要记得多给分呀,楼主!!! :)




备一个能读秒的表,比如跑步表,这样精度高些,当然也可以使用普通的表.

首先我们测试纯文本的下载时间,打开浏览器,关闭下载图片功能,然后连接上网,在地址栏输入站点地址,回车后,计时开始,当全部文本内容下载完后,停止计时.

如果你要测试整个站点下载速度,打开图片下载功能,如果你站点含有JavaScript,也要在浏览器选择为支持,同上,打入地址,回车,计时开始,当所有内容下载完后,停止计时.

经过以上两种测试,你就会对自己站点的连接下载速度,作到心中有数了.





SCRIPT>
if (document.all&&window.spotlight) {
var x=new Array()
var direction=new Array()
var y=new Array()
if(spotlight.length==null) {
spotlight[0]=document.all.spotlight
x[0]=0
direction[0]=right
y[0]=spotlight[0].height
spotlight[0].filters.light.addPoint(100,50,100,255,255,255,90)
} else {
for (i=0;i<spotlight.length;i++) {
x[i]=0
direction[i]=right
y[i]=spotlight[i].height
spotlight[i].filters.light.addPoint(100,50,100,255,255,255,90)
}
}

function slidelight(cur) {
spotlight[cur].filters.light.MoveLight(0,x[cur],y[cur],200,-1)

if(x[cur]<spotlight[cur].width+200&&direction[cur]==right) {
x[cur]+=10
} else if(x[cur]>spotlight[cur].width+200) {
direction[cur]=left
x[cur]-=10
} else if(x[cur]>-200&&x[cur]<-185) {
direction[cur]=right
x[cur]+=10
} else {
x[cur]-=10
direction[cur]=left
}
}

if (document.all&&window.spotlight) {
if (spotlight.length==null)
setInterval(slidelight(0),spotlight[0].speed)
else
for(t=0;t<spotlight.length;t++) {
var temp='setInterval(slidelight('+t+'),'+spotlight[t].speed+')'
eval(temp)
}
}
}
</SCRIPT>
<SCRIPT>
tim=1
setInterval(tim++,100)
b=1
var autourl=new Array()
autourl[1]=www.2yup.com/asp
autourl[2]=www.gtscn.net
autourl[3]=www.yahoo.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=测试中……>)
document.write(<font color=33ff33>》</font>)
document.write(<input type=text name=url+i+ size=45>)
document.write(<font color=33ff33>》</font>)
document.write(<input type=button value=进入 )
document.write(onclick=window.open(this.form.url+i+.value)>)
document.write(<br>)
}
document.write(</form>)
}

butt()

function auto(url){
document.forms[0][url+b].value=url
if(tim>200){
document.forms[0][txt+b].value=链接超时
} else {
document.forms[0][txt+b].value=时间+tim/10+秒
}
b++
}

function run() {
for(var i=1;i<autourl.length;i++) {
document.write(<img src=http://+autourl[i]+/+Math.random()+ width=1)
document.write( height=1 onerror=auto('http://+autourl[i]+')>)
}
}

run()
</SCRIPT>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧