Shop Amazon

Wednesday, February 12, 2025

Days left to file your tax

Here's an HTML file with JavaScript that displays a countdown timer for April 15, 2025. It will show the remaining days along with the message:
"You have only X days left to file your tax."

You can embed this in a WordPress site using the Custom HTML block or in a theme file.

Code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Tax Filing Countdown</title>
    <style>
        #countdown {
            font-size: 24px;
            font-weight: bold;
            color: red;
            text-align: center;
            margin-top: 20px;
        }
    </style>
</head>
<body>

<div id="countdown">Loading...</div>

<script>
    function updateCountdown() {
        const deadline = new Date("April 15, 2025 23:59:59").getTime();
        const now = new Date().getTime();
        const timeLeft = deadline - now;

        if (timeLeft > 0) {
            const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
            document.getElementById("countdown").innerHTML = 
                "You have only " + days + " days left to file your tax.";
        } else {
            document.getElementById("countdown").innerHTML = "The tax filing deadline has passed.";
        }
    }

    updateCountdown(); 
    setInterval(updateCountdown, 86400000); // Update every 24 hours
</script>

</body>
</html>

How to Embed in WordPress:

1. Using a Custom HTML Block:

Go to WordPress Editor > Add a Custom HTML block.

Paste the code above.

Save and preview.



2. Embedding in a Theme File:

Edit header.php, footer.php, or any template file where you want to display the countdown.

Paste the code inside the <body> section.

Save and refresh the page.




This will keep the countdown updated daily. Let me know if you need any modifications!

No comments:

Post a Comment