0
基本上我想用最後一個人的名字來更新一個頁面來提交表單。我有下面的代碼,但我只能讓它在一臺設備上更新。從其他設備查看頁面時,它沒有更新的名稱。如何更新所有瀏覽者的html頁面?
<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>
<br>
<input type="submit" value="Update!" onclick="updateTable();"/>
</form>
<p id="last"></p>
<script>
function updateTable(){
document.getElementById("last").innerHTML =document.forms['leds'].elements[3].value;
alert(document.forms['leds'].elements[3].value+", You are about to change the Lights! Beware that there is about a 30 second delay on the live stream.");
}
</script>
</html>
考慮使用數據庫來存儲數據和ajax以相應地檢查更新/過程? – Isaac 2014-11-23 05:39:34