Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <meta charset="UTF-8">
- <title class="timerForTitle">Title</title>
- </head>
- <body>
- <script>
- if(!sessionStorage.timerForTitle){
- sessionStorage.timerForTitle = 30;
- }
- var timer = setInterval(function () {
- var count = Number(sessionStorage.timerForTitle);
- if(--count >= 0){
- sessionStorage.timerForTitle = count;
- document.querySelector('.timerForTitle').innerHTML = 'Title '+count;
- }else{
- document.querySelector('.timerForTitle').innerHTML = 'Title finish';
- clearInterval(timer);
- }
- },1000);
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment