JS Implementation of simple speed Testing Method

Source: Internet
Author: User
<!  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  ALT  = "Test image"  SRC  = "Http://sp2.yokacdn.com/photos/f3/4f/702018/photo_322092_500.jpg"  Onload  = "Showspeed ();"  >  < Div  ID  = 'Showtxt'  > </  Div  >  <  Script  >      VaR  Arr  =  [  "  Network speed less than 50kb "  ,  "  The network speed is between 50-kb.  "  ,  "  The network speed is between kb and kb.  "  ,  "  The network speed is between-kb. "  ,  "  Video Communication  "  ];  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  )  ?  0 :( Speed  >  50   &&  Speed  <=  100  )  ?  1  :( Speed  > = 100   &&  Speed  <  200  )  ?  2  :( Speed  > =  200   && Speed  <  300  )  ?  3  :  4  ; Alert (scope) document. getelementbyid (  "  Showtxt "  ). Innerhtml  =  (  "  Your download speed is:  "   +  Arr [Scope]  +   "  (K/sec) "  )}  </  Script  >   </  Body  >  </  Html  > 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.