javascript - Random .HTML, how to make it stop -


i have pool of 23 different .html files, , need access them randomly. part easy, need them link different page after 40 of these pages have been shown. how can this?

         var starttime = new date();          mousetrap.bind('e', function () {              var endtime = new date();              var timespent = (endtime - starttime);              alert("correct " + timespent + "miliseconds");              window.location.href = loft;          })            mousetrap.bind('i', function() {                  var endtime = new date();                 var timespent = (endtime - starttime);                 $('img').css('display','block')                 alert("incorrecto " + timespent + "milisegundos");                  })         var loft= math.floor((math.random()*40)+1); 

mousetrap js library alows me link key strokes different functions. social psycology study on reaction time.

set counter in cookie can keep state of after change window location. plugin use managing cookies guy: https://github.com/carhartl/jquery-cookie though write simple functions set / unset cookies set cookie , cookie javascript

something effect:

   var counter = $.cookie("counter");      if (counter == undefined){     counter = 0;      }     var starttime = new date();          mousetrap.bind('e', function () {             if (counter < 40){              var endtime = new date();              var timespent = (endtime - starttime);              alert("correct " + timespent + "miliseconds");              $.cookie("counter", ++counter);               window.location.href = loft;             }else{                          //do stuff show thank page                      }          })            mousetrap.bind('i', function() {                  var endtime = new date();                 var timespent = (endtime - starttime);                 $('img').css('display','block')                 alert("incorrecto " + timespent + "milisegundos");                  })     var loft= math.floor((math.random()*40)+1); 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -