实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js">
5
</script>
6
<script>
7
$(document).ready(function(){
8
 var lastms,d;
9
$("button").click(function(event){
10
  if (lastms){
11
    d=event.timeStamp - lastms
12
    $("p").text("Milliseconds since last click event: " + d);
13
  } else {
14
    $("p").text("Click the button again.");
15
  }
16
  lastms=event.timeStamp;
17
});  
18
});  
19
</script>
20
</head>
21
<body>
22
23
<button>Click me</button>
24
<p></p>
25
26
</body>
27
</html>