• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
张继东
看铁蹄铮铮,踏遍万里河山。磨不破,打不烂。
   首页    新随笔    联系   管理    订阅  订阅

模拟测试网速的js

模拟测试网速的js

<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>

posted @ 2005-12-20 16:07  简单生活  阅读(1901)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3