Skip to content

Instantly share code, notes, and snippets.

@Unayung
Created April 4, 2025 12:50
Show Gist options
  • Save Unayung/d43e32b23d4af8ef0bc9c70294f79526 to your computer and use it in GitHub Desktop.
Save Unayung/d43e32b23d4af8ef0bc9c70294f79526 to your computer and use it in GitHub Desktop.
中午吃什麼v2
<!DOCTYPE html>
<html>
<head>
<title>中午吃什麼</title>
<style>
body {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #e6f0ff; /* 淺藍色背景 */
font-family: Arial, sans-serif;
}
button {
padding: 12px 24px;
font-size: 18px;
border-radius: 8px; /* 圓角按鈕 */
border: none;
background-color: #ffffff;
cursor: pointer;
}
#lunch {
margin-top: 20px;
font-size: 20px;
color: #333;
}
</style>
</head>
<body>
<button onclick="showLunch()">中午吃什麼?</button>
<div id="lunch">按一下看看吧!</div>
<script>
const lunchOptions = [
"吃個牛肉麵吧!",
"今天試試披薩!",
"來份便當怎麼樣?",
"吃點壽司吧!",
"炒飯快又好吃!"
];
function showLunch() {
const randomIndex = Math.floor(Math.random() * lunchOptions.length);
document.getElementById("lunch").innerHTML = lunchOptions[randomIndex];
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment