I am trying to display the text "A Day" on one day, then "B Day" the next. I can do this with the even or odd function then configure getDay
object, but i am trying to do this regardless of the day, month or year.
For example, today could be "A Day" tomorrow is "B Day" then the next day is an "A Day" and so on and so forth.
I have started some code, but don't quite understand concept.
<html>
<body>
<p id="demo"></p>
<script type="text/javascript">
myFunction();
function myFunction() {
var time = new Date().getDate();
if (time == 0) {
greeting = "A Day";
} else {
greeting = "B Day";
}
document.getElementById("demo").innerHTML = greeting;
}
</script>
</body>
</html>