summaryrefslogtreecommitdiff
path: root/wk8/lect/hello3.html
diff options
context:
space:
mode:
Diffstat (limited to 'wk8/lect/hello3.html')
-rw-r--r--wk8/lect/hello3.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/wk8/lect/hello3.html b/wk8/lect/hello3.html
new file mode 100644
index 0000000..6e1ce4e
--- /dev/null
+++ b/wk8/lect/hello3.html
@@ -0,0 +1,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>