SOURCE

console 命令行工具 X clear

                    
>
console
// 定义所有牌
const cards = [
    "3♠️", "3♥️", "3♦️", "3♣️",
    "4♠️", "4♥️", "4♦️", "4♣️",
    "5♠️", "5♥️", "5♦️", "5♣️",
    "6♠️", "6♥️", "6♦️", "6♣️",
    "7♠️", "7♥️", "7♦️", "7♣️",
    "8♠️", "8♥️", "8♦️", "8♣️",
    "9♠️", "9♥️", "9♦️", "9♣️",
    "10♠️", "10♥️", "10♦️", "10♣️",
    "J♠️", "J♥️", "J♦️", "J♣️",
    "Q♠️", "Q♥️", "Q♦️", "Q♣️",
    "K♠️", "K♥️", "K♦️", "K♣️",
    "A♠️", "A♥️", "A♦️", "A♣️",
    "2♠️", "2♥️", "2♦️", "2♣️",
    "小王", "大王"
];

// 初始化牌
const cardContainer = document.getElementById("cardContainer");
cards.forEach((card, index) => {
    const cardElement = document.createElement("div");
    cardElement.className = "card";
    cardElement.textContent = card;
    cardElement.addEventListener("click", () => {
        cardElement.classList.add("hidden");
    });
    cardContainer.appendChild(cardElement);
});

// 重置按钮
const resetButton = document.getElementById("resetButton");
resetButton.addEventListener("click", () => {
    const allCards = document.querySelectorAll(".card");
    allCards.forEach(card => {
        card.classList.remove("hidden");
    });
});
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢乐斗地主记牌器</title>
</head>
<body>
    <h1>欢乐斗地主记牌器</h1>
    <div id="cardContainer"></div>
    <button id="resetButton">重置</button>
</body>
</html>
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    padding: 20px;
}
.card {
    display: inline-block;
    width: 60px;
    height: 80px;
    margin: 5px;
    background-color: #007bff;
    color: white;
    text-align: center;
    line-height: 80px;
    font-size: 24px;
    border-radius: 10px;
    cursor: pointer;
}
.card.hidden {
    display: none;
}
#resetButton {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 18px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}