it is my first question here.
So I have this js linked to html file.
When I type for example it displeys the hours from js, but I cant make it display anything else by changing id to "seconds" or creating new element with another id. Why is this happening. I deleted all my css and all my body tag. Just one element with different id and only id = "hours" displays it correctly. Before that I managed to display every single one of them.
The point is to have a clock that displays time and date and the time to be refreshed every second so if u stay on the page to be changed.
I have read for hours posts about loading and DOM trees, but cant figure it out.
Thank you in advance. I apreciate it.
JS:
window.onload = function () {
someFunction();
function someFunction(){
setInterval(clock, 1000);}
}
function clock() {
var hours = document.getElementById("hours");
var minutes = document.getElementById("minutes");
var seconds = document.getElementById("seconds");
var month = document.getElementById("month");
let year = document.getElementById("year");
let date = document.getElementById("date");
var h = new Date().getHours();
var m = new Date().getMinutes();
var s = new Date().getSeconds();
var mm = new Date().getMonth();
let yy = new Date().getYear();
let dd = new Date().getDate();
if (h > 24) {
h = h - 24;
}
h = h < 10 ? "0" + h : h;
m = m < 10 ? "0" + m : m;
s = s < 10 ? "0" + s : s;
yy = yy % 100;
yy = `20${yy}`;
switch (mm) {
case '0':
mm = 'Януари'
break;
case 1:
mm = 'Февруари'
break;
case 2:
mm = 'Март'
break;
case 3:
mm = 'Април'
break;
case 4:
mm = 'Май'
break;
case 5:
mm = 'Юни'
break;
case 6:
mm = 'Юли'
break;
case 7:
mm = 'Август'
break;
case 8:
mm = 'Септември'
break;
case 9:
mm = 'Октомври'
break;
case 10:
mm = 'Ноември'
break;
case 11:
mm = 'Декември'
break;
}
hours.innerHTML = h;
minutes.innerHTML = m;
seconds.innerHTML = s;
month.innerHTML = mm;
year.innerHTML = yy;
date.innerHTML = dd;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
</head>
<body>
<div id = "hours">111</div>
<script src="script.js"></script>
</body>
</html>
prednisone over the counter uk – where to get prednisone prednisone 5 mg tablet cost
https://cialisbob.com/ tadalafil cost
provigil online – gnprovigl.com provigil vs nuvigil
https://wardenafil.com levitra expired
http://himscanada.com/ generic tadalafil pills
http://levitradd.com/ best price for levitra 20 mg
buy liquid ivermectin – ivermectin 12 mg ivermectin without a doctor prescription
https://prescriptionhim.com/ viagra without a doctor prescription
amoxicillin prices at walmart – buy amoxicilina 500 mg from mexico amoxil USA
http://himshairloss.com/ finasteride
viagra from mexico to usa – where to buy otc ed pills viagra pills online canada
http://sansordonnancemd.com viagra masculin
ivermectin buy nz – how to buy stromectol ivermectin 0.5 lotion india
https://viagraxyu.com cheapest viagra 100mg
https://stromectolhumans.com/ ivermectin dosage
https://iwermectin.com/ stromectol 3mg tablets price
lasix medicine price – lasix medicine price 220 lasix
order clomiphene – where can i buy clomid clomiphene for sale
https://ivermectineffects.com/ stromectol 6mg
https://ivermectinovercounter.com/ ivermectin
https://ivermectineffects.com ivermectin
australia online pharmacy free shipping – cialis cheap cialis online australia
https://ivermectinus.com/ stromectol 3mg scabies
best price for levitra 20mg http://levitrair.com difference between cialis and levitra
http://zithrozpack.com/ z-pak
buy ivermectin https://stromectolus.com ivermectin use in mexico
sildenafil 100mg from india – can i buy viagra over the counter female viagra australia
generic tadalafil 2017 – advcialisp.com cialis 20 mg tablet cost
https://albuterolotc.com/ albuterol sulfate 90 mcg price
ivermectin for cattle http://stromectolus.com ivermectin
ivermectin cream 1 – stromectol price comparison buy liquid ivermectin
ivermectin for humans for sale http://ivermcov.com/# ivermectin
javascript-help.li reviewed fda approved otc medications https://pharmvolk.com good rx pharmacy coupons
what kind of doterra oils is good for arthritis? http://ventolinhfaer.com/ alternatives to ventolin hfa inhaler
blood pressure watch http://doctorborat.com best price for viagra
javascript-help.li with ivermectina oral http://ivermectiny.com ivermectin
bone on bone arthritis purchasing ivermectin for humans https://iveramectin.com ivermectin tablets for sale walmart
blood pressure chart for elderly http://canadian2pharmacy.com best online pharmacies
viagra without a doctor prescription http://viagrob.com how to tell if a man is taking viagra
javascript-help.li recommended ivermectin for humans for sale https://ivermectinhum.com kГёb ivermectin nz
methylprednisolone 16 mg – best price for lyrica cost for lyrica
ivermectin for sale stromectol without prescription http://stromectl.com ivermektin otc
sildenafilo http://goldkamagra.com kamagra kaufen why html is displaying given elements by js script but not others? – JavaScript Help
z pack antibiotics dose https://azithrozpack.com antibiotics over the counter
stromectol generic https://ivermectin1.com/ ivermectin tablets for sale walmart
http://ivrmectin.com – stromectol 3 mg tablets price
http://stromectolo.com – is ivermectin safe for people