Skip to content

Instantly share code, notes, and snippets.

@KimiyukiYamauchi
Created April 23, 2021 04:31
Show Gist options
  • Save KimiyukiYamauchi/83e8c7c43ff3ce330fe4a2eb2ae99e44 to your computer and use it in GitHub Desktop.
Save KimiyukiYamauchi/83e8c7c43ff3ce330fe4a2eb2ae99e44 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: content: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
<script src="components/loader.js"></script>
<link rel="stylesheet" href="components/loader.css">
<link rel="stylesheet" href="css/style.css">
<script>
function greet() {
var date = new Date();
var hour = date.getHours() + 10;
if (hour >= 5 && hour <= 10) {
document.getElementById("message").innerHTML = "おはよう!";
document.getElementById("icon").src = "images/morning.png";
} else if (hour >= 11 && hour <= 18) {
document.getElementById("message").innerHTML = "こんにちは!";
document.getElementById("icon").src = "images/afternoon.png";
} else {
document.getElementById("message").innerHTML = "こんばんは!";
document.getElementById("message").style.color = '#ffffff';
document.getElementById("message").style.backgroundColor = "#ff0cff";
document.getElementById("message").style.paddingTop = '30px';
document.getElementById("message").style.paddingBottom = '100px';
document.getElementById("icon").src = "images/evening.png";
// document.body.style.backgroundColor = "black";
}
}
</script>
</head>
<body onload="greet()">
<p id="message"></p>
<img id="icon" src="">
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment