抽奖 致582班的元旦庆典(Updated)
抽奖 致582班的元旦庆典(Updated)

抽奖 致582班的元旦庆典(Updated)

抽奖活动

抽奖活动

点击下方按钮开始抽奖,看看你会获得奖励还是惩罚!

奖励: 一张免处罚卡
惩罚: 做俯卧撑5个

感谢参与本次抽奖活动!祝您好运!

参加内测的人员有:赵子萱 张馨丹
代码编写:本页版主

以下是本页HTML代码:

这点小项目还是直接开源

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抽奖活动</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: linear-gradient(135deg, #f8f9fa, #add8e6);
            margin: 0;
            padding: 0;
            color: #333;
        }

        header {
            background-color: #ff6347;
            color: white;
            text-align: center;
            padding: 30px 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        header h1 {
            font-size: 2.5rem;
            margin: 0;
        }

        header p {
            font-size: 1.2rem;
            margin: 10px 0 0;
        }

        .content {
            margin: 30px auto;
            max-width: 600px;
            background: #ffffff;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
        }

        .button-container {
            text-align: center;
            margin-top: 20px;
        }

        .button {
            background-color: #32cd32;
            color: white;
            font-size: 18px;
            padding: 15px 30px;
            border: none;
            cursor: pointer;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        .button:hover {
            background-color: #228b22;
        }

        .result {
            display: none;
            text-align: center;
            font-size: 20px;
            margin-top: 30px;
        }

        .reward, .penalty {
            display: inline-block;
            margin: 10px;
            padding: 10px;
            border-radius: 10px;
            font-size: 22px;
            font-weight: bold;
        }

        .reward {
            background-color: #ffeb3b;
            color: #333;
            box-shadow: 0 4px 8px rgba(255, 235, 59, 0.6);
        }

        .penalty {
            background-color: #ff5722;
            color: white;
            box-shadow: 0 4px 8px rgba(255, 87, 34, 0.6);
        }

        .footer {
            text-align: center;
            margin-top: 50px;
            font-size: 14px;
            color: #888;
        }

        .loading {
            font-size: 24px;
            color: #32cd32;
        }
    </style>
</head>
<body>

<header>
    <h1>抽奖活动</h1>
    <p>点击下方按钮开始抽奖,看看你会获得奖励还是惩罚!</p>
</header>

<div class="content">
    <div class="button-container">
        <button class="button" id="startBtn">开始抽奖</button>
    </div>

    <div class="result">
        <div class="reward" id="reward">奖励: 一张免处罚卡</div>
        <div class="penalty" id="penalty">惩罚: 做俯卧撑5个</div>
    </div>

    <div id="loading" class="loading"></div>
</div>

<footer class="footer">
    <p>感谢参与本次抽奖活动!祝您好运!</p>
</footer>

<script>
    const rewards = [
        "糖果",
        "一张免处罚卡",
        "两张免处罚卡",
        "一张特权卡",
        "谢谢惠顾",
        "奖励三个橘子",
        "再来一次",
        "免值日一次",
        "一道数学题(要求现场做,可以场外求助一个人)"
    ];

    const penalties = [
        "唱一首歌(可以选择一个受害者)",
        "写一份卷子交给老康",
        "说出班里五个人的外号",
        "模仿一位老师",
        "坐深蹲15个(女生替换为深蹲20个)",
        "俯卧撑5个",
        "元旦值日",
        "表演一个节目",
        "模仿一个搞笑视频的动作",
        "大处罚:学委定制英语单词(超级精品)"
    ];

    function drawLottery() {
        document.getElementById("loading").style.display = "block";
        document.querySelector(".result").style.display = "none";

        document.getElementById("loading").innerText = "即将显示结果...";

        setTimeout(() => {
            document.getElementById("loading").style.display = "none";

            let randomChoice = Math.random() < 0.7 ? 'reward' : 'penalty';
            let randomText = randomChoice === 'reward' ? rewards[Math.floor(Math.random() * rewards.length)] : penalties[Math.floor(Math.random() * penalties.length)];

            document.querySelector(".result").style.display = "block";
            if (randomChoice === 'reward') {
                document.getElementById("reward").innerText = "奖励: " + randomText;
                document.getElementById("penalty").innerText = '';
            } else {
                document.getElementById("penalty").innerText = "惩罚: " + randomText;
                document.getElementById("reward").innerText = '';
            }
        }, 3000);
    }

    document.getElementById('startBtn').addEventListener('click', drawLottery);
</script>

</body>
</html>

一条评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注