Skip to content

Instantly share code, notes, and snippets.

@markandey
Created January 28, 2011 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markandey/801261 to your computer and use it in GitHub Desktop.
Save markandey/801261 to your computer and use it in GitHub Desktop.
A quick & simple test to show you which browser is faster
<!DOCTYPE HTML>
<html>
<head>
<title>DOM + JavaScript Test</title>
</head>
<script>
var count=0;
var stop=true;
function testfun(){
document.getElementById("count").innerHTML=""+Math.sqrt(count);
ID=count%100;
document.getElementById("ID"+ID).innerHTML="-<div id=\"ID"+(ID+1)+"\">testnode</div>";
count++;
if(!stop){
setTimeout(testfun,1);
}
}
function startTest(){
stop=!stop;
setTimeout(testfun,1);
}
</script>
<body>
<div id="doc" >
<div id="hd" role="banner"><h1>DOM + JavaScript Test</h1></div>
<div id="bd" role="main">
<button onclick="startTest();">Click me to start</button>
<div id="count"></div>
<div id="ID0">
</div>
<div id="ft" role="contentinfo"><p>by:<a href="http://www.markandey.com">markandey</a></p></div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment