文章摘要
This HTML page is designed to showcase a collection of sad quotes. It includes a styled interface with a button titled "Get Sad Quotes" that triggers a JavaScript function to display a random quote from a predefined list when clicked. The function `displayRandomQuote()` selects and presents a quote from the `shangganQuotes` array. The content is focused on emotional and reflective sayings about loss, memories, and the nature of life.
— 文章部分摘要由DeepSeek深度思考而成
![图片[1]|随机一言 html|不死鸟资源网](https://busi.net/wp-content/uploads/2025/06/20250607105641236-image-1024x493.png)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>伤感语录</title>
<style>
body {
font-family: "Microsoft YaHei", sans-serif;
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.container {
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
h1 {
color: #333;
text-align: center;
margin-bottom: 30px;
}
#quote {
font-size: 18px;
line-height: 1.6;
color: #555;
margin-bottom: 20px;
padding: 20px;
background-color: #f9f9f9;
border-left: 4px solid #e74c3c;
border-radius: 0 5px 5px 0;
}
button {
display: block;
margin: 20px auto;
padding: 10px 20px;
background-color: #e74c3c;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
button:hover {
background-color: #c0392b;
}
</style>
</head>
<body>
<div class="container">
<h1>伤感语录</h1>
<div id="quote">点击下方按钮获取伤感语录</div>
<button onclick="displayRandomQuote()">获取伤感语录</button>
</div>
<script>
// 本地定义的伤感语录数组
const shangganQuotes = [
"人生就是这样,难免有痛,难免有伤,无论我是否曾经抓住抑或远去,那些东西都不可能离我而去,虽然有些事不能回首,有些回忆不能梳理,有些人只能永远埋藏。",
"有时候,我们明知道没路了,却还在前行,因为习惯了。",
"有时候,明明说好了不再去介怀,可是,转过身,还是忍不住落泪。",
"一个人的寂寞,有时候,很难隐藏得太久,时间越长,就沉得越重。",
"有些事,不是不在意,而是在意了又能怎样。",
"有些人,一旦失去了,就再也回不来了。",
"有些回忆,注定只能留在心底。",
"曾经的梦,曾经的痛,曾经的爱,都已经随风而去。",
"人生若只如初见,何事秋风悲画扇。",
"有些人,注定是生命中的过客,有些事,注定无法挽回。"
];
function displayRandomQuote() {
// 从数组中随机选择一条伤感语录
const randomIndex = Math.floor(Math.random() * shangganQuotes.length);
document.getElementById('quote').textContent = shangganQuotes[randomIndex];
}
</script>
</body>
</html>
本站文章部分内容可能来源于网络,仅供大家学习参考,如有侵权,请联系站长📧cutwork@qq.com进行删除处理!
THE END