So I know that when you put a URL in the action of an HTML form it will send the users to that url. I also added in the target attribute target=_blank
to open the new URL in a new window. But I want to close that window and stay on the original site where the form was submitted form. I tried to do this by naming the target window and closing it but that didn't work out. I am wondering if there is a simple way to do this.
<form name=leds id=ledSend method=get target=newWindow action=https://agent.electricimp.com/NkzPvVKeHshT>
Lamp Control: <input type=radio name=led value=0 checked>Off
<input type=radio name=led value=1>On<br>
How long should the Lights stay on? <input type=text name=timer value=10>seconds<br>
Your name? For Our Records <input id=name type=text name=user placeholder=Your name here><br>
<input type=submit value=Update! onclick=alert(theInput.value +', You are about to change the Light! Keep in mind that there will be about a 2 second delay on the LiveStream.')/>
<script>
var theInput = document.getElementById(name);
</script>
</form>
<script>
newWindow.close();
</script>