<html>
<body>
<p> Click the button to get a time-based greeting. </ p>
<button onclick="myFunction()"> Try it </ button>
<p id="demo"> </ p>
<script>
function myFunction ()
{
var x = "";
var time = new Date (). getHours ();
if (time <11)
X = "Good Morning its eleven in the morning";
}
else if (time <20)
{
x = "Good Day";
}
else
{
x = "Good evening
}
document.getElementById ("demo"). innerHTML = x;
}
</ Script>
</ Body>
</ Html>
Walang komento:
Mag-post ng isang Komento