Created
April 4, 2025 11:41
-
-
Save Unayung/b94ec37c03b2532a4fd934f785396a7c to your computer and use it in GitHub Desktop.
中午吃什麼
This file contains hidden or 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> | |
<title>中午吃什麼</title> | |
<style> | |
body { text-align: center; font-family: Arial, sans-serif; } | |
button { padding: 10px 20px; font-size: 16px; } | |
#lunch { margin-top: 20px; font-size: 18px; } | |
</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