<! Doctype html> <html> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title> 防止重复表单提交 </title> <style> #refresh {display: none; Ширина: 200px; Высота: 20px; фоновый цвет: #ff0; } </style> <script> var inprocess = false; window.onload = function () {document.forms ["picker"]. onsubmit = validatesubmit; document.getElementbyId ("rebresh"). onclick = startover; } function validatesubmit () {// 防止重复的表单提交 if (inprocess) return; inProcess = true; console.log (inprocess); document.getElementById ("Opperbutton"). отключен = true; document.getElementbyId ("rebresh"). style.display = "block"; document.getElementById ("Сообщение"). innerHtml = "<p> 正在 Обработка , 稍等 </p>"; вернуть ложь; } function startover () {inprocess = false; document.getElementById ("Opperbutton"). отключен = false; document.getElementbyId ("Сообщение"). innerHtml = ""; document.getElementbyId ("rebresh"). style.display = "none"; } </script> </head> <body> <form id="picker" method="post" action=""> group1:<input type="radio" name="group1" value="one" /> group2:<input type="radio" name="group1" value="two" /> group3:<input type="radio" name="group1" value="three" /><br /><br /> Input 1: <input type="text" id="intext" /> Input 2: <input type="text" id="intext2" /> Input 3: <input type="text" id="intext3" /> <input type="submit" id="submitbutton" value="send form" /> </form> <div id="refresh"> <p>单击我</p> </div> <div id="message"></div> </body> </html>