diff options
Diffstat (limited to 'wk8/lect/hello2.html')
-rw-r--r-- | wk8/lect/hello2.html | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wk8/lect/hello2.html b/wk8/lect/hello2.html new file mode 100644 index 0000000..a2baede --- /dev/null +++ b/wk8/lect/hello2.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> + +<html lang="en"> + <head> + <title>hello2</title> + </head> + <body> + <form> + <input autocomple="off" autofocus id="name" placeholder="Name" type="text"> + <input type="submit"> + </form> + <script> + + document.querySelector('form').addEventListener('submit', function(event) { + alert('hello, ' + document.querySelector('#name').value); + event.preventDefault(); + }); + + </script> + </body> +</html> |