用javascript来检查连接速度??

lxh5192 2006-03-14 11:51:02
如果在客户端测试出连接速度?
比如:用户A在广州要下载一个文件。而网站B在北京,网站C在上海。
用户A的客户端如何自动检测出B和C那个网站的下载速度更快?
麻烦各位大侠给点思路或指点!!!
...全文
149 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lxh5192 2006-03-16
  • 打赏
  • 举报
回复
暂时使用计算图片的加载速度来判断网速了。呵呵
iuhxq 2006-03-15
  • 打赏
  • 举报
回复
http://blog.csdn.net/iuhxq/archive/2006/03/07/618286.aspx
gu1dai 2006-03-15
  • 打赏
  • 举报
回复
meizz通过计算图片的加载速度来判断网速。
楼上的说法看起来可行。
net205 2006-03-15
  • 打赏
  • 举报
回复
用Ajax
开始时间1
请求b网站
完成
结束时间1

开始时间2
请求c网站
完成
结束时间2

结束时间1-开始时间1
结束时间2-开始时间2
来比较,,,

不过可能不准确。。。。。
不懂,,看后面别人的回答.......
mingxuan3000 2006-03-15
  • 打赏
  • 举报
回复
mark
shenjf2000 2006-03-15
  • 打赏
  • 举报
回复
net205(向MVP学习!) 的方法可能是一个比较好的方法。
zhangjidong 2006-03-15
  • 打赏
  • 举报
回复
<script>
tim=1
//每0.1s tim++
setInterval("tim++",100)
b=1

var autourl=new Array()
autourl[1]="www.cnblogs.com"
autourl[2]="www.cnblogs.com/zhangjidong"
autourl[3]="www.cctv.com"
autourl[4]="www.sina.com.cn"

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=测试中……> =》<input type=text name=url"+i+" size=40> =》<input type=button value=GO onclick=window.open(this.form.url"+i+".value)><br>")
document.write("<input type=submit value=刷新></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 height=1 onerror=auto('http://"+autourl[i]+"')>")
}
run()
</script>
meizz 2006-03-15
  • 打赏
  • 举报
回复
测速: http://www.meizz.com/web/demo/treeview/4096.htm

52,787

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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