Bosna i Hercegovina



#1 17.08.2011-08:58
zxz Online
Administrator
Registrovan/a od: 03.02.2009-16:22
Komentari: 9,737


Subject: Isprobajte brzinu vaseg Browsera
Kopirajte ovaj kod u notepad ze ka zapisite kao test.html
DownloadIzvorni kod (HTML):
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3.  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  5.  <head>
  6.  <title>browser speed test</title><!-- version 2.1 -->
  7.  <meta name="author" content="Kubissimo_"/>
  8.  <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
  9.  <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"/>
  10.  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  11.  <meta http-equiv="content-style-type" content="text/css"/>
  12.  <style type="text/css">
  13.  body {
  14.     margin: 0px;
  15.     background-color: #FFFFFF;
  16.     color: #333333;
  17.     font-family: sans-serif;
  18.     font-size: small;
  19.  }
  20.  table {
  21.     border: 12px solid #EEEEFF;
  22.     padding: 7px 7px 0px 7px;
  23.     text-align: right;
  24.  }
  25.  .input {
  26.     width: 170px;
  27.     text-align: right;
  28.  }
  29.  #displayBrowser {
  30.     width: 728px;
  31.     background-color: #FFFFCC;
  32.  }
  33.  #displayTotal {
  34.     background-color: #FFFFCC;
  35.  }
  36.  </style>
  37.  <script type="text/javascript">
  38.  // <!--
  39. window.onload = function() {
  40.    document.getElementById("displayBrowser").value = navigator.userAgent;
  41. };
  42. var pre = new Array(48);
  43. var loaded = 0;
  44. for (var i=0; i<48; i++) {
  45.    pre[i] = new Image(62, 62);
  46.    pre[i].id = "pre_"+i;
  47.    pre[i].src = "http://hscripts.com/" + "freeimages/icons/clipart/cube/cube-icon-picture"+(i+1)+".gif";
  48.    pre[i].onload = function() {loaded++;};
  49. }
  50. function preLoadImages() {
  51.    document.getElementById("preLoadImages").disabled = true;
  52.    if (loaded < 48) {
  53.       window.setTimeout("preLoadImages();", 333);
  54.       return;  
  55.    }
  56.    document.getElementById("performSpeedTest1").disabled = false;
  57.    document.getElementById("displayTotal").value = "ready!?  ";
  58. }
  59. var startTime = 0;
  60. function performSpeedTest1() {
  61.    document.getElementById("performSpeedTest1").disabled = true;
  62.    startTime = new Date().getTime();
  63.    for (var i=0; i<12*12; i++) {
  64.       for (var j=0; j<12; j++) {
  65.          if (i >= 4) {
  66.             var newImg = document.createElement("img");
  67.             newImg.id = "pre_"+(i*12+j);
  68.             newImg.src = pre[(i*12+j)%48].src;
  69.             document.getElementById("testingAppendChild").appendChild(newImg);
  70.          }
  71.          else {
  72.             document.getElementById("testingAppendChild").appendChild(pre[i*12+j]);
  73.          }
  74.       }
  75.       document.getElementById("testingAppendChild").appendChild(document.createElement("br"));
  76.    }
  77.    stopTime(1);
  78. }
  79. function performSpeedTest2() {
  80.    var test = new String();
  81.    for (var i=0; i<12*12; i++) {
  82.       for (var j=0; j<12; j++) {
  83.          test += '<img id="pre_'+(12*12+i*12+j)+'" src="'+pre[(i*12+j)%48].src+'" width="62" height="62" border="0" alt=""/>';
  84.       }
  85.    test += "<br/>";
  86.    }
  87.    document.getElementById("testingInnerHTML").innerHTML = test;
  88.    stopTime(2);
  89. }
  90. function performSpeedTest3() {
  91.    for (var i=0; i<12*12*12*12; i++) {
  92.       getDistance(Math.random(), Math.random(), Math.random(), Math.random());
  93.    }
  94.    stopTime(3);
  95.    document.getElementById("reloadSpeedTest").disabled = false;
  96. }
  97. var total = 0;
  98. function stopTime(num) {
  99.    window.setTimeout(function() {
  100.       var endTime = new Date().getTime();
  101.       var result = (endTime - startTime) + " milliseconds";
  102.       total += (endTime - startTime);
  103.       document.getElementById("displayTest"+num).value = result;
  104.       startTime = endTime;
  105.       if (num == 1) {
  106.          performSpeedTest2();
  107.       }
  108.       else if (num == 2) {
  109.          performSpeedTest3();
  110.       }
  111.       else if (num == 3) {
  112.          document.getElementById("displayTotal").value = "total = "+total+" milliseconds";
  113.       }
  114.    }, 0);
  115. }
  116. function getDistance(ax, ay, bx, by) {
  117.    return Math.sqrt(Math.pow(bx-ax, 2) + Math.pow(by-ay, 2));
  118. }
  119. function reloadSpeedTest() {
  120.    window.location.href = window.location.href;
  121. }
  122. // -->
  123.  </script>
  124.  </head>
  125.  <body>
  126.  <table>
  127.  <tr>
  128.     <td colspan="4"><input id="displayBrowser" type="text" value="loading..."/></td>
  129.  </tr>
  130.  <tr>
  131.     <td><input id="reloadSpeedTest" class="input" type="button" disabled="disabled" value="reload speed test" onclick="reloadSpeedTest();"/></td>
  132.     <td><input id="preLoadImages" class="input" type="button" value="preload images" onclick="preLoadImages();"/></td>
  133.     <td><input id="performSpeedTest1" class="input" type="button" disabled="disabled" value="perform speed test" onclick="performSpeedTest1();"/></td>
  134.     <td><input id="displayTotal" class="input" type="text" value="hello legend!  "/></td>
  135.  </tr>
  136.  <tr>
  137.     <td colspan="3">testing: DOM methods: createElement('img'), appendChild(imgObject)</td>
  138.     <td><input id="displayTest1" class="input" type="text" value=""/></td>
  139.  </tr>
  140.  <tr>
  141.     <td colspan="3">testing: String object: str += str2; DOM manipulation: innerHTML = str</td>
  142.     <td><input id="displayTest2" class="input" type="text" value=""/></td>
  143.  </tr>
  144.  <tr>
  145.     <td colspan="3">testing: Math object: Math.pow(x, y), Math.sqrt(z), and Math.random()</td>
  146.     <td><input id="displayTest3" class="input" type="text" value=""/></td>
  147.  </tr>
  148.  <tr>
  149.     <td colspan="4"><div id="testingAppendChild"></div></td>
  150.  </tr>
  151.  <tr>
  152.     <td colspan="4"><div id="testingInnerHTML"></div></td>
  153.  </tr>
  154.  </table>
  155.  </body>
  156.  </html>

Pozdrav
↑  ↓

Stranice (1): 1


All times are GMT +01:00. Current time: 14.08.2018-12:04.