summaryrefslogtreecommitdiff
path: root/wk8/lect/hello3.html
blob: 6e1ce4e46e7411cb366886eefdf3caadc0e37085 (plain)
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 lang="en">
    <head>
        <script>

            document.addEventListener('DOMContentLoaded', function() {
                document.querySelector('form').addEventListener('submit', function(event) {
                    alert('hello, ' + document.querySelector('#name').value);
                    event.preventDefault();
                });
            });

        </script>
        <title>hello2</title>
    </head>
    <body>
        <form>
            <input autocomplete="off" autofocus id="name" placeholder="Name" type="text">
            <input type="submit">
        </form>
    </body>
</html>