File tree 1 file changed +23
-0
lines changed
user-input-with-forms/studio
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="utf-8 ">
5
5
< script >
6
+ let action = {
7
+ "google" : "https://www.google.com/search" ,
8
+ "duckDuckGo" : "https://duckduckgo.com/" ,
9
+ "bing" : "https://www.bing.com/search" ,
10
+ "ask" : "https://www.ask.com/web"
11
+
12
+ }
13
+ function setSearchEngine ( ) {
14
+ const form = document . querySelector ( 'form' ) ;
15
+ const query = document . getElementById ( 'q' ) ;
16
+
17
+
18
+ }
19
+
6
20
// TODO: create a handler
7
21
window . addEventListener ( "load" , function ( ) {
8
22
// TODO: register the handler
23
+
24
+ const form = document . querySelector ( "form" ) ;
25
+ form . addEventListener ( "submit" , setSearchEngine ( ) ) ;
9
26
} ) ;
10
27
</ script >
11
28
</ head >
14
31
15
32
< form id ="searchForm ">
16
33
<!-- TODO: add form elements -->
34
+ < label > < input type ="text " name ="q "> </ label >
35
+ < label > < input type ="radio " name ="engine " value ="google "> Google</ label >
36
+ < label > < input type ="radio " name ="engine " value ="duckDuckGo "> DuckDuckGo</ label >
37
+ < label > < input type ="radio " name ="engine " value ="bing "> Bing</ label >
38
+ < label > < input type ="radio " name ="engine " value ="ask "> Ask</ label >
39
+ < label > < input type ="button " name ="submit " value ="Go! "> </ label >
17
40
</ form >
18
41
19
42
</ body >
You can’t perform that action at this time.
0 commit comments