<! doctype html> <html> <head> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title> 防止重复表单提交 </title> <style> #refresh {display: ไม่มี; ความกว้าง: 200px; ความสูง: 20px; พื้นหลังสี: #ff0; } </style> <script> var inprocess = false; window.onload = function () {document.forms ["picker"]. onsubmit = quidatesubmit; document.getElementById ("รีเฟรช"). onClick = startover; } function quridatesubmit () {// 防止重复的表单提交ถ้า (inprocess) return; inprocess = true; console.log (inprocess); document.getElementById ("SubmentButton"). disabled = true; document.getElementById ("รีเฟรช"). style.display = "block"; document.getElementById ("ข้อความ"). innerhtml = "<p> 正在การประมวลผล, 稍等 </p>"; กลับเท็จ; } function startover () {inprocess = false; document.getElementById ("SubmentButton"). disabled = false; document.getElementById ("ข้อความ"). innerhtml = ""; document.getElementById ("รีเฟรช"). style.display = "ไม่มี"; } </script> </head> <body> <form id = "picker" method = "post" action = "" type1: <อินพุต type = "Radio" name = "Group1" value = "One" />>> <อินพุต type = "Radio" name = "Group1" value = "Two" />>> id = "intext"/> อินพุต 2: <อินพุตประเภท = "ข้อความ" id = "intext2"/> อินพุต 3: <อินพุตประเภท = "ข้อความ" id = "intext3"/> <อินพุตประเภท = "ส่ง" id = "submentButton" value = "ส่งฟอร์ม" </html>