how to make a clock in html/javascript
JavaScript
<!-- This is set automatically to your time zone -->
<script>
function showTime(){
var date = new Date();
var d = date.getDate();
var d1 = date.getDay();
var h = date.getHours(); // 0 - 23
var m = date.getMinutes(); // 0 - 59
var s = date.getSeconds(); // 0 - 59
var session = "PM";
if(h == 02){
h = 12;
}
if(h > 12){
session = "PM";
}
if(h < 12) {
session = "AM"
}
h = (h < 10) ? "0" + h : h;
m = (m < 10) ? "0" + m : m;
s = (s < 10) ? "0" + s : s;
var time = d + "/"+ d1+ " " + "Time:" + " " + h + ":" + m + ":" + s + " " + session;
document.getElementById("MyClockDisplay").innerText = time;
document.getElementById("MyClockDisplay").textContent = time;
setTimeout(showTime, 1000);
}
showTime();
</script>
<style>
body {
background: url('computerIMGedit.jpg');
color: white;
}
.clock {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
color: #e6967e;
font-size: 60px;
font-family: 'Josefin Sans', sans-serif;
letter-spacing: 7px;
-webkit-transition: 0.5s;
}
.clock:hover {
transform: translateY(-10px);
transition: 0.5s;
font-size: 80px;
color: whitesmoke;
}
</style>
<div id="MyClockDisplay" class="clock" onload="showTime()">
</div>
Also in JavaScript:
- Title
- generate random number javascript
- Category
- JavaScript
- Title
- express url redirect
- Category
- JavaScript
- Title
- firestore set a document
- Category
- JavaScript
- Title
- brute force search javascript
- Category
- JavaScript
- Title
- how to setstate in parent in child component in react native
- Category
- JavaScript
- Title
- get a element using name in jquery
- Category
- JavaScript
- Title
- how to add up all numbers in an array
- Category
- JavaScript
- Title
- find a single element in array of objects javascript
- Category
- JavaScript
- Title
- include gif in react
- Category
- JavaScript
- Title
- how to pass custom regex in jquery validation
- Category
- JavaScript
- Title
- event target javascript
- Category
- JavaScript
- Title
- filter array objects javascript
- Category
- JavaScript
- Title
- ajax .put
- Category
- JavaScript
- Title
- bootstrap modal remove gray background
- Category
- JavaScript
- Title
- autocomplete typeahead ajax
- Category
- JavaScript
- Title
- express validator always return error
- Category
- JavaScript
- Title
- how to generate random character from an array js
- Category
- JavaScript
- Title
- count number of times an element is occuring in an array in javascript
- Category
- JavaScript
- Title
- app listen with all error handling
- Category
- JavaScript
- Title
- adding cors parameters to extjs ajax
- Category
- JavaScript
- Title
- get last element of array javascript
- Category
- JavaScript
- Title
- discord.js dm user
- Category
- JavaScript
- Title
- javascript add option element to select
- Category
- JavaScript
- Title
- empty a select input using js
- Category
- JavaScript
- Title
- array.splice javascript
- Category
- JavaScript
- Title
- emit resize event in angular
- Category
- JavaScript
- Title
- enable disable click on div jquery
- Category
- JavaScript
- Title
- install php7 runtime brackets
- Category
- JavaScript
- Title
- bootstrap datepicker js cdn
- Category
- JavaScript
- Title
- checking object is empty in JS
- Category
- JavaScript
- Title
- deno
- Category
- JavaScript
- Title
- Angular material design
- Category
- JavaScript
- Title
- angular subscribe
- Category
- JavaScript
- Title
- disable javascript chrome
- Category
- JavaScript
- Title
- how to write img jsx
- Category
- JavaScript
- Title
- check if javascript function is true
- Category
- JavaScript
- Title
- function inside object javascript
- Category
- JavaScript
- Title
- How to check if a member has a role discord.js
- Category
- JavaScript
- Title
- dotnet core ajax post of an ojject site:stackoverflow.com
- Category
- JavaScript
- Title
- array reverse algorithm in js
- Category
- JavaScript
- Title
- javascript check if array is empty
- Category
- JavaScript
- Title
- get day js
- Category
- JavaScript
- Title
- google script get name of google form
- Category
- JavaScript
- Title
- indexing string in javascript
- Category
- JavaScript
- Title
- how to run different node app on server different domains
- Category
- JavaScript
- Title
- http requests in vue 3
- Category
- JavaScript
- Title
- html decode javascript
- Category
- JavaScript
- Title
- ISS proxy express
- Category
- JavaScript
- Title
- An unhandled exception occurred: Script file ../node_modules/jquery/dist/jquery.min.js does not exist.
- Category
- JavaScript
- Title
- javascript base64 encode
- Category
- JavaScript
- Title
- javascript access pushed element
- Category
- JavaScript
- Title
- check multiple ifield if it's blank in jquery
- Category
- JavaScript
- Title
- append img to svg d3 js
- Category
- JavaScript
- Title
- chart.js data from mysql vanila javscript
- Category
- JavaScript
- Title
- Better Array check with Array.isArray Because arrays are not true array in JavaScript, there is no simple typeof check. No problem! Use the method Array.isArray to check…
- Category
- JavaScript
- Title
- How to get the path to the file that required your module?
- Category
- JavaScript
- Title
- angular img
- Category
- JavaScript
- Title
- how to ask input in javascript
- Category
- JavaScript
- Title
- Date gethours js
- Category
- JavaScript
- Title
- how to use chart js in vue js
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- add jquery to wordpress
- Category
- JavaScript
- Title
- file input disable open file picker javascript
- Category
- JavaScript
- Title
- concat js mdn
- Category
- JavaScript
- Title
- how to get textedit on mac without download
- Category
- JavaScript
- Title
- extend react.component
- Category
- JavaScript
- Title
- append to array js
- Category
- JavaScript
- Title
- discord.js
- Category
- JavaScript
- Title
- how to freeze js object
- Category
- JavaScript
- Title
- async await javascript push
- Category
- JavaScript
- Title
- get the state of a checkbox
- Category
- JavaScript
- Title
- get number right of the dot length javascript
- Category
- JavaScript
- Title
- document get element by tag
- Category
- JavaScript
- Title
- import reactdom
- Category
- JavaScript
- Title
- check if string is datestring javascript
- Category
- JavaScript
- Title
- get value of checked radio button jquery
- Category
- JavaScript
- Title
- discord.js send message to channel
- Category
- JavaScript
- Title
- button style not working react native
- Category
- JavaScript
- Title
- how to loop object javascript
- Category
- JavaScript
- Title
- "npm supertest
- Category
- JavaScript
- Title
- javascript addeventlistener
- Category
- JavaScript
- Title
- add class javascript
- Category
- JavaScript
- Title
- Alert.alert closing expo
- Category
- JavaScript
- Title
- array javascript
- Category
- JavaScript
- Title
- how to save thing in cookie js
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- custom processing datatables
- Category
- JavaScript
- Title
- expresiones ternarias javascript
- Category
- JavaScript
- Title
- add all elements in array javascript
- Category
- JavaScript
- Title
- copy to clipboard javascript
- Category
- JavaScript
- Title
- how to update jquery datatable row cell value
- Category
- JavaScript
- Title
- how to get a toggle button to do different js functions
- Category
- JavaScript
- Title
- how to iterate through an object in javascript
- Category
- JavaScript
- Title
- best way to filter table in angular
- Category
- JavaScript
- Title
- change the focus to next in angular forms
- Category
- JavaScript
- Title
- bubble sort javascript
- Category
- JavaScript
- Title
- how to add a class to html using javascript
- Category
- JavaScript
- Title
- error Unexpected end of JSON input while parsing near '...
- Category
- JavaScript
- Title
- ad data to js object
- Category
- JavaScript
- Title
- how to get a value into a react component
- Category
- JavaScript