有人帮助我显示我的代码(请等待倒计时或等待秒数。 代码有效,但我只想显示扩孔秒数
就像显示扩孔时间一样,当按钮从禁用状态再次启用时
<?php
if (!isset($_SESSION)) {
session_start();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$_SESSION['postdata'] = $_POST;
unset($_POST); //unsetting $_POST Array
header("Location: ".$_SERVER['REQUEST_URI']);//This will let your uri parameters to still exist
exit;
}
?>
答案 0 :(得分:0)
这是一个简单的工作片段。
function submitPoll(){
let btn=document.getElementById("votebutton"),
cdn=document.getElementById("countdown"),
n=5;
cdn.innerHTML = 'Please wait ' + (n--) + ' seconds.';
btn.disabled = true;
let t=setInterval(function() {
if (n)
cdn.innerHTML = 'Please wait ' + (n--) + ' seconds.';
else {
cdn.innerHTML='';
btn.disabled=false;
clearInterval(t);
}
}, 1000);
}
document.getElementById("votebutton").addEventListener("click", submitPoll);
<form method="post" action="">
<button id="votebutton">Submit</button>
<div id="countdown"></div>
</form>