I want my function "thing()" to run automatically from the page load. At the moment it is activated by a button.
HTML
<button onclick="thing()">Greeting</button>
Javascript
function thing() {
var greeting;
var time = new Date().getHours();
if (time < 10) {
greeting = "Good morning";
} else if (time < 20) {
greeting = "Good day";
} else {
greeting = "Good Evening";
}
document.getElementById("address").innerHTML = greeting;
}
I am very new to java script so as simply please.