Hello!
I need to make a timer that moves the user to another page when time passes. Example.
Fight one user with another. One uses one attack, the other uses another. But after a while one of them realized that if he continued the battle, he would lose. Fight time 5 minutes. So that user waits for these 5 minutes, throws them out of the battle and did not add anyone, did not take away his glasses. I need to create a timer, which after the expiration of the time, will throw out the user who cheated on the page of loss, and who was waiting for the enemy to be like - on the page of winning.
Is it possible to make this timer so?
<head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title>тест</title> </head> <body> <div id="timer"></div> <script> var limit = 5; // в секундах function processTimer() { if (limit > 0) { setTimeout("processTimer()", 1000); limit--; } else { // здесь действия после завершения таймера //.. } var limit_div = parseInt(limit / 60); // минуты var limit_mod = limit - limit_div * 60; // секунды // строка с оставшимся временем limit_str = " "; if (limit_div < 10) limit_str = limit_str + "0"; limit_str = limit_str + limit_div + ":"; if (limit_mod < 10) limit_str = limit_str + "0"; limit_str = limit_str + limit_mod + " "; // вывод времени el_timer = document.getElementById("timer"); if (el_timer) el_timer.innerHTML = limit_str; } processTimer(); </script> </body>
How to re-address the pages?