Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <button onclick="darkmode()""dark()">Darkmode</button>
- <script>
- document.getElementById('darkmode()').onclick = changeColor;
- var currentColor = "white";
- function changeColor() {
- if(currentColor == "white()"){
- document.body.style.color = "black";
- currentColor = "black";
- } else {-
- document.body.style.color = "white";
- currentColor = "white";
- }
- }
- function darkmode() {
- if (document.body.style.backgroundColor == 'rgb(255, 255, 255)') {
- document.body.style.backgroundColor = '#333';
- }
- else {
- document.body.style.backgroundColor = 'rgb(255, 255, 255)';
- }
- }
- document.getElementById('dark()').onclick = changeColor;
- var currentColor = "white";
- function changeColor() {
- if(currentColor == "white"){
- document.body.style.color = "black";
- currentColor = "black";
- } else {
- document.body.style.color = "white";
- currentColor = "white";
- }
- }
- </script>
- <script>
- function startTime() {
- var today = new Date();
- var h = today.getHours();
- var m = today.getMinutes();
- var s = today.getSeconds();
- m = checkTime(m);
- s = checkTime(s);
- document.getElementById('txt').innerHTML =
- h + ":" + m + ":" + s;
- var t = setTimeout(startTime, 500);
- }
- function checkTime(i) {
- if (i < 10) {i = "0" + i};
- return i;
- }
- </script>
- </head>
- <body onload="startTime()">
- <div id="txt"></div>
- </body>
- <body>
- <button id= "dark()">Change color</button>
- <script>
- document.getElementById('dark()').onclick = changeColor;
- var currentColor = "white";
- function changeColor() {
- if(currentColor == "white"){
- document.body.style.color = "black";
- currentColor = "black";
- } else {
- document.body.style.color = "white";
- currentColor = "white";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement