Грамматика

<div style="border: 2px dashed #6B5CE7; padding: 20px; text-align: center; border-radius: 10px; background: #f9f9f9;">
    <h3>🛒 疯狂购物小测试</h3>
    <p>你现在的预算:<span id="money">1000</span> 元</p>
    <div id="message" style="height: 30px; color: red;"></div>
    
    <button onclick="buyItem()" style="background: #6B5CE7; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px;">
        🛍️ 买一个包包 (200元)
    </button>

    <script>
        let money = 1000;
        function buyItem() {
            if(money >= 200) {
                money -= 200;
                document.getElementById('money').innerText = money;
                document.getElementById('message').innerText = "✅ 购买成功!真有钱!";
            } else {
                document.getElementById('message').innerText = "❌ 没钱啦!快去赚钱!";
            }
        }
    </script>
</div>