|
<div id="test" style="width: 100%; height: 200px; background: red;"></div>
<div id="result"></div>
<script type="text/javascript">
var Time = {};
document.getElementById("test").addEventListener('touchstart',function(){
Time.t1 = (new Date()).getTime();
},false);
document.getElementById("test").addEventListener('mousedown',function(){
Time.t2 = (new Date()).getTime();
},false);
document.getElementById("test").addEventListener('click',function(){
Time.t3 = (new Date()).getTime();
document.getElementById("result").innerHTML = 'touchstart - mousedown = ' + (Time.t2 - Time.t1) + '<br />'
'mousedown - click = ' + (Time.t3 - Time.t2) ;
},false);
</script> |
|