1 <html><head><title>Cookie Test</title>
7 for(var i=0; i < numLoops; i++){
8 var randomNumber=Math.floor(Math.random()*11);
10 time.setTime(time.getTime() + 1000);
11 var cookieString = "cookie" + randomNumber + "=true; expires=" + time.toGMTString();
12 var preW = new Date().getTime();
13 document.cookie = cookieString;
14 var postW = new Date().getTime();
15 if(document.cookie.indexOf(("cookie" + randomNumber)> 0));
16 var postR = new Date().getTime();
17 totalW += (postW - preW);
18 totalR += (postR - postW);
20 document.write("<br><br>avg R(millis):" + totalR/numLoops);
21 document.write("<br>avg W(millis):" + totalW/numLoops);
26 <body onload="javascript:cookieTest();setTimeout(cookieTest(), 1000);">