[Html]
<! Doctype html>
<Html>
<Head>
<Script type = "text/javascript" src = "test/jquery-1.7.2.min.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
Var last, diff;
$ ('Div '). click (function (event ){
If (last ){
Diff = event. timeStamp-last
$ ('Div '). append ('time since last event:' + diff + '<br/> ');
} Else {
$ ('Div '). append ('click again. <br/> ');
}
Last = event. timeStamp;
});
});
</Script>
<Style type = "text/css">
Div {height: 100px; width: 300px; margin: 10px;
Background-color: # ffd; overflow: auto ;}
</Style>
</Head>
<Body>
<Div> Click. </div>
</Body>
</Html>
<! Doctype html>
<Html>
<Head>
<Script type = "text/javascript" src = "test/jquery-1.7.2.min.js"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
Var last, diff;
$ ('Div '). click (function (event ){
If (last ){
Diff = event. timeStamp-last
$ ('Div '). append ('time since last event:' + diff + '<br/> ');
} Else {
$ ('Div '). append ('click again. <br/> ');
}
Last = event. timeStamp;
});
});
</Script>
<Style type = "text/css">
Div {height: 100px; width: 300px; margin: 10px;
Background-color: # ffd; overflow: auto ;}
</Style>
</Head>
<Body>
<Div> Click. </div>
</Body>
</Html>
The above code mainly introduces the timeStamp (timeStamp) of the event object.
Click the area after running, and the interval between the last click will be displayed. The person playing the game can test how fast you can click the mouse.