From cb593153bd35ed646d10f8cb2b287d3f19f4f489 Mon Sep 17 00:00:00 2001 From: AustinAYates Date: Tue, 8 Oct 2019 18:31:49 -0500 Subject: [PATCH 1/2] some more stuff --- index.html | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index d78a52c..926eaf3 100644 --- a/index.html +++ b/index.html @@ -3,17 +3,44 @@
- + + + + + + +
\ No newline at end of file From b04436a5264ee3de589c496e5f47a4b5a9e443bb Mon Sep 17 00:00:00 2001 From: AustinAYates Date: Tue, 8 Oct 2019 19:16:45 -0500 Subject: [PATCH 2/2] final changes --- index.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 926eaf3..78557e9 100644 --- a/index.html +++ b/index.html @@ -13,11 +13,22 @@ function setSearchEngine() { console.log("setSearchEngine has run"); let buttons = document.getElementsByName('engine'); + let submitForm = document.getElementById('searchForm'); + + //ALTERNATIVE VERSION IF FOLLOWING CODE DOES NOT WORK + // if (buttons[0].checked) { + // submitForm.action = actions["google"]; + // } else if (buttons[1].checked) { + // submitForm.action = actions["duckDuckGo"]; + // } else if (buttons[2].checked) { + // submitForm.action = actions["bing"]; + // } else { + // submitForm.action = actions["ask"]; + // } + + let selectedBtn = document.querySelector('input[name=engine]:checked'); + submitForm.action = actions[selectedBtn.id]; - console.log(buttons); - console.log(buttons[0].checked); - console.log(buttons[0].id); - console.log(buttons[1].value); } window.addEventListener("load", function(event) { @@ -33,7 +44,7 @@ -
+