javaScript 测试下载速度

news/2024/7/7 12:37:55

<script>
function init(){
var timer1=new Date().getTime();
var img=new Image();
img.src="http://www.netfront.net/speedtest/images/photo" + parseInt(Math.round(Math.random()*5)+1) + ".bmp?" + Math.random();
img.οnlοad=function(){
size=img.fileSize;
alert("下载速度: " + Math.round(size/(new Date().getTime()-timer1)) + " KB/S");
}
document.body.appendChild(img);
}
</script>
<body οnlοad="javascript:init()">

</body>


http://www.niftyadmin.cn/n/529811.html

相关文章

CMDB学习之六 --客户端请求测试,服务端api优化

客户端使用agent 请求测试&#xff0c;agent使用的POST 请求&#xff0c;使用requests模块 本地采集&#xff0c;汇报服务端 #!/usr/bin/env python # -*- coding:utf-8 -*- from .base import BaseHandler from ..plugins import get_server_info import requests import json…

FLEX杂谈——flex就业现状与学习标准分析

写下这个标题大家一定以为我是只FLEX老鸟,不然不敢这么高声说话,而且是在JAVAEYE里.我知道JE里高手很多.有很多人都对FLEX有秀深的见底,写此文是为了回答一些朋友对我的提问. 有很多想转行的开发者都问我这样几个问题:现在招FLEX的公司多吗?搞FLEX开发工资高吗?怎么样才算是F…

php的 提示无效字符,PHP无效字符错误

运行此代码时出现此错误&#xff1a;致命错误&#xff1a;test.php中带有消息’无效字符错误’的未捕获异常’DOMException’&#xff1a;29堆栈跟踪&#xff1a;#0 test.php(29)&#xff1a;DOMDocument-> createElement(‘1OhmStable’,’a’)#1 { main}在第29行的test.ph…

学习笔记66—兴趣阅读之哲学(佛学)

摘要: 题记&#xff1a;不阅读的人只能过一种人生&#xff0c;参与阅读的人能过成百上千的人生。&#xff08;PS&#xff1a;每读完一本书&#xff0c;一定要写读后感&#xff01;&#xff01;&#xff01;&#xff09;转载于:https://www.cnblogs.com/hechangchun/p/10495554.…

php 单行日历,PHP完整的日历类(CLASS)

class Calendar{/** www.jb51.net修正版*/var $YEAR,$MONTH,$DAY;var $WEEKarray("星期日","星期一","星期二","星期三","星期四","星期五","星期六");var $_MONTHarray("01">"一月&…

ES6小技巧笔记

1:去重数组 let a [1, 1, 2, 2, 3, 3, 4, 4, 5, 5]let b [...new Set(a)]console.log(2222222222, b) // [1, 2, 3, 4, 5]2:合并数组let arr1 [a, b]let arr2 [c]let arr3 [d, e]let arr4 arr1.concat(arr2, arr3)let arr5 [...arr1, ...arr2, ...arr3]console.log…

php实现hmac sha1,PHP:如何生成字符串的hmac SHA1签名?

我正在尝试使用PHP连接到API并需要正确的签名.他们的文件逐字记录&#xff1a;The command string needs to hashed using HMAC SHA-1 hashing algorithmagainst the API secret key. The resulting byte array should be Base64encoded in UTF-8 format so that it can be pas…

房贷计算公式

//本息还款的月还款额(参数: 年利率/贷款总额/贷款总月份) //function getMonthMoney1(lilv,total,month){ // var lilv_month lilv / 12;//月利率 // return total * lilv_month * Math.pow(1 lilv_month, month) / ( Math.pow(1 lilv_month, m…