Here is the code, i can't get an image of a cake on the body, or the entired html. I've tried HTML like body background, I've tried style , and I've tried js, nothing works. Funny thing, I've tested the image on other pages, loads fine. I've also tried modifying the background color using html, css, js, they all work fine. But the damn image won't load. Any ideas?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Age Calculator</title>
</head>
<body>
<style>
#myDiv {
background-image: url('images/cake.png');
background-size: cover;
}
</style>
<div id="myDiv">
<script>
//document.body.style.backgroundImage = "url('images/cake.jpg')";
//document.getElementById("myDiv").style.backgroundImage = "url('images/cake.jpg')";
let birthYear = prompt("Enter Your Birth Year");
let birthMonth = prompt("Enter Your Birth Month (As A Number)");
let birthDay = prompt("Enter Your Birth Day");
let date = new Date();
let currentYear = date.getFullYear();
let currentMonth = date.getMonth() + 1;
let currentDay = date.getDate();
let yearAge = currentYear - birthYear;
let monthAge = currentMonth - birthMonth;
let dayAge = currentDay - birthDay;
let monthPluralizer = "";
let dayPluralizer = "";
if (monthAge === 1) {
monthPluralizer = "Month";
} else {
monthPluralizer = "Months";
}
if (dayAge === 1) {
dayPluralizer = "Day";
} else {
dayPluralizer = "Days";
}
if (currentMonth < birthMonth) {
monthAge = monthAge + 12;
yearAge = yearAge - 1;
}
if (currentDay < birthDay) {
monthAge = monthAge - 1;
if (currentMonth === 1 || 3 || 5 || 7 || 8 || 10 || 12) {
dayAge = dayAge + 31;
} else if (currentMonth === 4 || 6 || 9 || 11) {
dayAge = dayAge + 30;
} else if (currentMonth === 2) {
dayAge = dayAge + 28;
}
}
if (currentMonth == birthMonth && currentDay < birthDay) {
monthAge = monthAge + 12;
yearAge = yearAge - 1;
}
document.write("<p>Your Birth Date Is " + birthMonth + "/" + birthDay + "/" + birthYear + "</p><br>");
document.write("<p>Today's Date Is " + currentMonth + "/" + currentDay + "/" + currentYear + "</p><br>");
document.write("<p>You Are " + yearAge + " Years, " + monthAge + " " + monthPluralizer + " & " + dayAge +
" " + dayPluralizer + " Old.</p><br>");
if (birthMonth == 0 && birthDay == 0 && birthYear == 0 ) {
document.write("<p>Hello Jesus!<p>")
} else if (birthMonth === null && birthDay === null && birthYear === null ) {
document.write("<p>Hello Jesus!<p>")
}
</script>
</div>
</body>
</html>