2014-11-25 82 views
0

我有一個提交url操作的表單。不過,我不希望它在提交時使用url打開一個新窗口。我應該如何避免這種情況?如何使表單在​​提交url操作時無法打開新窗口?

<form name="leds" id="ledSend" method="get" target="_blank" action="https://agent.electricimp.com/Fk43xPMkSrWF"> 
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)"/> 
<script> 

var theInput = document.getElementById(「name」);

我不想當它處於這種形式的窗口切換到

https://agent.electricinp.com 

。我將如何避免這種情況,以便用戶停留在提交表單表單的原始頁面上。

回答

1

擺脫target="_blank"

<form name="leds" id="ledSend" method="get" action=""> 
+0

這仍然留下原來的頁面,去https://agent.electricimp.com/Fk43xPMkSrWF – 2014-11-25 00:29:09

+0

這就是你給他們。你期望會發生什麼? – 2014-11-25 00:29:32

+0

有沒有辦法留在原來的頁面,但仍然使http請求到網站? – 2014-11-25 00:29:35

相關問題