Created
February 20, 2012 06:56
-
-
Save omkz/1868183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no,initial-scale=1.0"> | |
<title> Hello Menk </title> | |
<script type="text/javascript"> | |
// returns the current hour | |
function GetCurrentHour() | |
{ | |
// obtaining the current hour | |
var date = new Date(); | |
var hour = date.getHours(); | |
// return the hour | |
return hour; | |
} | |
function(){ | |
return 20; | |
} | |
// display greeting | |
function DisplayGreeting(hourFunc) | |
{ | |
// retrieve the hour using the function received as parameter | |
hour = hourFunc(); | |
// display greeting | |
if (hour >= 22 || hour <= 5) | |
document.write("Goodnight, world!"); | |
else | |
document.write("Morning, world!"); | |
} | |
</script> | |
</head> | |
<body> | |
<button onclick="DisplayGreeting(GetCurrentHour)">Klik</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment