forked from LaunchCodeEducation/HTTP-and-Forms-Studio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·26 lines (23 loc) · 948 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// let setSearchEngine = new function(){
// return document.querySelector("input[name=engine]:checked");
// }
window.addEventListener("load", function(){
let form = document.querySelector("form");
form.addEventListener("submit", function(event) {
let setSearchEngine = document.querySelector("input[name=engine]:checked");
// // let searchInput = document.querySelector("input[name=q]");
// // if(searchInput.value === "" || setSearchEngine === false);
// // {
// // alert("All fields are required!");
// // event.preventDefault();
// // }
let actions =
{
"google": "https://www.google.com/search",
"duckDuckGo": "https://duckduckgo.com/",
"bing": "https://www.bing.com/search",
"ask": "https://www.ask.com/web"
};
document.searchForm.action = actions[setSearchEngine.value]
});
});