datbarCheckJS/erdatbarenaaben.html

54 lines
1.4 KiB
HTML
Raw Normal View History

2016-01-04 01:39:27 +00:00
<!DOCTYPE html>
<head>
<meta charset="utf-8">
2016-02-03 23:13:34 +00:00
<link rel="stylesheet" href="style.css" media="screen" charset="utf-8">
2016-01-04 01:39:27 +00:00
<script>
2016-03-04 13:47:36 +00:00
var datbarCheck = function()
2016-01-04 01:39:27 +00:00
{
var d = new Date();
var n = d.getDay();
var t = d.getTime();
var hours = d.getHours();
var minutes = d.getMinutes();
2016-03-04 13:47:36 +00:00
var weekday = ["Søndag", "Mandag" , "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", ];
2016-01-04 01:39:27 +00:00
var answer = document.getElementById("answer")
2016-03-04 13:47:36 +00:00
if (n == 4)
2016-01-04 01:39:27 +00:00
{
2016-03-04 13:47:36 +00:00
if(hours == 02){
answer.innerHTML = "Baren er desværre lukket nu!</br> <h3>(Så gå dog i seng.)</h3>"
}
else if(hours > 15 ){
answer.innerHTML = "Baren har været åben i " + ((15 - hours) * -1) ;
if((15-hours *-1) == 1){
answer.innerHTML = "time og " + minutes + " minutter";
}
else {
answer.innerHTML = "timer og " + minutes + " mintter";
}
}
answer.innerHTML = "Baren åbner om " + ((hours - 15) * -1 ) + " timer</br> <h3> Vi glæder os alle</h3>";
2016-01-04 01:39:27 +00:00
}
else
{
2016-03-04 13:47:36 +00:00
answer.innerHTML = "Baren er desværre ikke åben, da det er " + weekday[n] + ". Burde du ikke læse?";
2016-01-04 01:39:27 +00:00
}
}
</script>
2016-01-04 01:39:27 +00:00
</head>
<body onload="datbarCheck();">
<div id="print"></div>
<div id="answer"></div>
</body>
</html>