Javascript弹出停止一段时间后


javascript popup stop after some time

我创建了一个简单的javascript弹出窗口,它将要求用户等待10分钟或继续处理。在我的php网站,我已经把一个条件,如果时间少于10分钟,那么只有弹出应该出现。我需要为javascript编写另一个函数,即使在刷新页面后也只能弹出10分钟,之后它不应该出现。由于我是javascript的新手,我无法获得正确的函数来克服它。非常感谢你的帮助,谢谢

这是我的弹出代码:

function confirmation() {
    var answer = confirm("You are trying to payment again, please wait for 10 mins to avoid duplicate payment. Click OK to wait and Cancel to continue pay")
    if (answer){
        alert("Thank you for waiting,please check your mail in 10 minutes, if you did not recieve any mail, proceed to purchase again.")
            document.formDealPayment.submit();
    }
    else{
        alert("Thank You.")
    }
}

您需要在服务器端执行此操作,因为客户端JavaScript本身无法知道服务器时间以及自用户上次刷新页面以来已经过了多长时间。(除了cookie,但这里有点过头了)

不太确定PHP和经典ASP是如何结合在一起的,但是简单的经典ASP代码只会在10分钟后调用函数:

If (10 minutes passed) Then
    Response.Write("<script type=""text/javascript"">confirmation();</script>")
End If