0
我正在嘗試爲freebitco.in創建一個腳本,該腳本將有一個到期日期,以便腳本過期時,彈出窗口會顯示告訴用戶腳本已過期並要求用戶單擊確定,以便頁面刷新。到期日和pagerefresh
但我所能得到的腳本是顯示到期日期和倒計時,但它不會顯示任何彈出窗口,我不知道爲什麼。
// Set the date we're counting down to
var countDownDate = new Date("Dec 1, 2017 15:37:25").getTime();
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now an the count down date
var distance = countDownDate - now;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance/(1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24))/(1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60))/(1000 * 60));
var seconds = Math.floor((distance % (1000 * 60))/1000);
// Output the result in an element with id="demo"
document.getElementById("demo").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "EXPIRED";
}}, 1000);
thankx很多,但實際工作的行之後,但我不希望它HV另一種選擇用戶點擊羯羊OK或cancle,我希望它只有一個確定的選項,用戶將點擊和頁面將刷新 –
@PhyzyProgrammer您可以使用: 'alert(「EXPIRED - Reload?」); location.reload();' – Dcdanny
好的兄弟,我能夠單獨編碼OKAY按鈕,但是當我點擊它時,它不會刷新請問我做錯了什麼,這裏是代碼>>> if(alert(「EXPIRED - 聯繫您的組管理員以獲取腳本的更新版本!「)){location.reload(); } –