- C++
HTML资源分享1
- 2024-10-6 16:56:59 @
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>//标题</title>
<link rel="stylesheet" href="">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
text-align: center;
padding: 20px;
}
.section {
background-color: #fff;
border-radius: 10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
max-width: 400px;
margin: auto;
padding: 20px;
}
.section__title {
font-size: 24px;
color: #333;
}
.button {
display: inline-block;
padding: 10px 20px;
margin-top: 20px;
background-color: #28a745;
color: white;
text-decoration: none;
border-radius: 5px;
}
.quote-box {
margin-top: 20px;
}
.quote-box h2 {
margin-bottom: 10px;
}
.quote {
font-size: 18px;
color: #333;
font-style: italic;
}
</style>
</head>
<body>
<div class="section">
<div class="section__header">
<h1 class="section__title">//按钮的名字</h1>
</div>
<div class="section__body">
<a href="javascript:void(0)" class="button" id="checkin-btn">
<span class="icon icon-feeling-lucky"></span>
你该做哪到题目呢?
</a>
</div>
<div class="quote-box" id="quote-box">
<h2>今日题目</h2>
<span class="quote" id="random-quote">//如果没有按下按钮,会显示什么?</span>
</div>
</div>
<script>
document.getElementById('checkin-btn').addEventListener('click', function() {
const quotes = [
"p1101",
"p1102",
"p1103",
"p1104",
"p1105"
];
// 随机
const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
// 显示随机
document.getElementById('random-quote').textContent = randomQuote;
});
</script>
</body>
</html>
效果自己试
1 条评论
-
-
//标题 body { font-family: Arial, sans-serif; background-color: #f4f4f4; text-align: center; padding: 20px; } .section { background-color: #fff; border-radius: 10px; box-shadow: 0 0 15px rgba(0, 0, 0, 0.1); max-width: 400px; margin: auto; padding: 20px; } .section__title { font-size: 24px; color: #333; } .button { display: inline-block; padding: 10px 20px; margin-top: 20px; background-color: #28a745; color: white; text-decoration: none; border-radius: 5px; } .quote-box { margin-top: 20px; } .quote-box h2 { margin-bottom: 10px; } .quote { font-size: 18px; color: #333; font-style: italic; }
//按钮的名字
<div class="quote-box" id="quote-box"> <h2>今日题目</h2> <span class="quote" id="random-quote">//如果没有按下按钮,会显示什么?</span> </div>
- 1