• API
• FAQ
• Tools
• Archive
daily pastebin goal
62%
SHARE
TWEET

# Untitled

a guest Jun 13th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. const element = document.createElement("div");
2. element.id = "demo";
3. element.innerText = 'TEXT';
4. element.style.position = 'absolute';
5. element.style.bottom = '10px';
6. element.style.right = '10px';
7. document.body.appendChild(element);
8.
9. // Set the date we're counting down to
10. var countDownDate = new Date("Jun 14, 2018 20:30:00").getTime();
11.
12. // Update the count down every 1 second
13. var x = setInterval(function() {
14.
15.   // Get todays date and time
16.   var now = new Date().getTime();
17.
18.   // Find the distance between now an the count down date
19.   var distance = countDownDate - now;
20.
21.   // Time calculations for days, hours, minutes and seconds
22.   var days = Math.floor(distance / (1000 * 60 * 60 * 24));
23.   var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
24.   var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
25.   var seconds = Math.floor((distance % (1000 * 60)) / 1000);
26.
27.   // Display the result in the element with id="demo"
28.   document.getElementById("demo").innerHTML = days + "d " + hours + "h "
29.   + minutes + "m " + seconds + "s ";
30.
31.   // If the count down is finished, write some text
32.   if (distance < 0) {
33.     clearInterval(x);
34.     document.getElementById("demo").innerHTML = "EXPIRED";
35.   }
36. }, 1000);
37. const tytul = document.createElement("div");
38. tytul.id = "MamLambo";
39. tytul.innerText = 'Do MamLambo:';
40. tytul.style.position = 'absolute';
41. tytul.style.bottom = '25px';
42. tytul.style.right = '10px';
43. document.body.appendChild(tytul);
44.
45. const ramka = document.createElement("div");
46. ramka.id = "Ramka";
47. ramka.style.border = '1px solid blue';
48. ramka.style.bottom = '26px';
49. ramka.style.right = '9px';
50. document.body.appendChild(ramka);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top