Home Web Front-end JS Tutorial Complete example of js simple network speed test method_javascript skills

Complete example of js simple network speed test method_javascript skills

May 16, 2016 pm 03:25 PM
js test Internet speed

The example in this article describes the js simple network speed test method. Share it with everyone for your reference, the details are as follows:

The screenshot of the running effect is as follows:

The specific code is as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
 <title> New Document </title>
 <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
 <meta name="Generator" content="EditPlus">
 <meta name="Author" content="xinmingyang">
 <meta name="Keywords" content="">
 <meta name="Description" content="">
 </head>
 <body>
 <SCRIPT language=JavaScript>
   var st = new Date();
</SCRIPT>
<img src="/static/imghw/default1.png"  data-src="http://www.jb51.net/images/logo.gif"  class="lazy"  alt="Complete example of js simple network speed test method_javascript skills" onload="showspeed();">
<div id='showtxt'></div>
<script>
  var arr=["网速低于50KB","网速在50-100KB之间","网速在100-200KB之间","网速在200-300KB之间","视频通讯"];
  function showspeed() 
  { 
    var filesize =35.4;  //measured in KB  
    var et = new Date(); 
    var speed = Math.round(filesize*1000)/(et - st);
    document.title=speed;
    var scope=(speed>0 && speed<=50)&#63;0:(speed>50 && speed<=100)&#63;1:(speed>=100 && speed<200)&#63;2:(speed>=200 && speed<300)&#63;3:4;
    alert(scope)
    document.getElementById("showtxt").innerHTML = ("您的下载速度为:" + arr[scope] + " (K/秒)") 
  } 
</script>
 </body>
</html>

Copy after login

I hope this article will be helpful to everyone in JavaScript programming.

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What do you think of furmark? - How is furmark considered qualified? What do you think of furmark? - How is furmark considered qualified? Mar 19, 2024 am 09:25 AM

What do you think of furmark? 1. Set the &quot;Run Mode&quot; and &quot;Display Mode&quot; in the main interface, and also adjust the &quot;Test Mode&quot; and click the &quot;Start&quot; button. 2. After waiting for a while, you will see the test results, including various parameters of the graphics card. How is furmark qualified? 1. Use a furmark baking machine and check the results for about half an hour. It basically hovers around 85 degrees, with a peak value of 87 degrees and room temperature of 19 degrees. Large chassis, 5 chassis fan ports, two on the front, two on the top, and one on the rear, but only one fan is installed. All accessories are not overclocked. 2. Under normal circumstances, the normal temperature of the graphics card should be between &quot;30-85℃&quot;. 3. Even in summer when the ambient temperature is too high, the normal temperature is &quot;50-85℃

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Dec 17, 2023 pm 06:55 PM

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

Recommended: Excellent JS open source face detection and recognition project Recommended: Excellent JS open source face detection and recognition project Apr 03, 2024 am 11:55 AM

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ​​and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to create a stock candlestick chart using PHP and JS How to create a stock candlestick chart using PHP and JS Dec 17, 2023 am 08:08 AM

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Join a new Xianxia adventure! 'Zhu Xian 2' 'Wuwei Test' pre-download is now available Apr 22, 2024 pm 12:50 PM

The "Inaction Test" of the new fantasy fairy MMORPG "Zhu Xian 2" will be launched on April 23. What kind of new fairy adventure story will happen in Zhu Xian Continent thousands of years after the original work? The Six Realm Immortal World, a full-time immortal academy, a free immortal life, and all kinds of fun in the immortal world are waiting for the immortal friends to explore in person! The "Wuwei Test" pre-download is now open. Fairy friends can go to the official website to download. You cannot log in to the game server before the server is launched. The activation code can be used after the pre-download and installation is completed. "Zhu Xian 2" "Inaction Test" opening hours: April 23 10:00 - May 6 23:59 The new fairy adventure chapter of the orthodox sequel to Zhu Xian "Zhu Xian 2" is based on the "Zhu Xian" novel as a blueprint. Based on the world view of the original work, the game background is set

How to increase Internet speed in WIN10 How to increase Internet speed in WIN10 Mar 27, 2024 pm 04:51 PM

1. After entering the win10 system, right-click the Start button and click [Command Prompt]. 2. Make sure that User Account Control is turned on, enter the command: netshinterfacetcpshowglobal and press Enter in the pop-up command prompt window. As can be seen from the above figure, in the global parameters of tcp, the automatic adjustment level of the receiving window is normal. At this time, it needs to be turned off. However, a command failure request will be received on IPv4, so you need to go to the command prompt (administrator) to operate. 3. Right-click the Start button and select [Command Prompt (Administrator)]. 4. Enter the command: netshinttcpsetglobalautotuninglevel=

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts Dec 18, 2023 pm 03:39 PM

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese

How to solve the problem of slow network speed on Win7 computer How to solve the problem of slow network speed on Win7 computer Jan 04, 2024 am 09:17 AM

Many friends who use win7 system computers find that the Internet speed is extremely slow when using the computer. What is happening? It may be that there are certain restrictions on the network in your network settings. Today I will teach you how to remove network restrictions and make the network speed extremely fast. Just select the advanced settings and change the value to "20MHz/ 40MHzauto" is enough. Let’s take a look at the specific tutorials. Methods to improve the network speed of win7 computer 1. The editor takes the win7 system as an example to illustrate. Right-click the "Network" icon on the right side of the desktop taskbar and select "Network and Sharing Center" to open it. 2. Click "Change Adapter Settings" in the newly appeared interface, then right-click "Local Area Connection" and select "Properties" to open. 3. In the open "Local

See all articles