03取得网络的下载速度.htm

来自「介绍了javascript的常用的函数」· HTM 代码 · 共 20 行

HTM
20
字号
<html>
<head>
<title>取得网络的下载速度</title>
<script language="javascript">
<!--
	time1 = (new Date()).getTime();
	pageSize = 500/1024;
	function getVelocity(){
		time2 = (new Date()).getTime();
		time = time2 - time1;
		time = time / 1000;
		v = Math.floor(pageSize / time);
		alert("网络的下载速度为: "+v+" KB/妙");
	}
//-->
</script>
</head>
<body onLoad="getVelocity()">
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?