about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/3/4.html
blob: 0444d1ee33dd7da30b3940b3d32101529f498a05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<script src='https://code.jquery.com/jquery-3.5.1.min.js'
        integrity='sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0='
        crossorigin='anonymous'></script>

<body>
  <h1>Heading1</h1>
  <h2>Heading2</h2>
  <p>Paragraph</p>
  <button>Button</button>
  <div id="log"></div>
  <script>
    let previous;
    $('button').click(function (event) {
        current = Date.now();
        if (previous !== undefined)
            $('#log').html(`${current-previous} ms`);
        previous = current;
    })
  </script>
</body>
</html>