<html>
<body background="egg.gif">
<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").innerHHTML=x;
}
</script>
</body>
</html>
Walang komento:
Mag-post ng isang Komento