Skip to content
Om Puter

Om Puter

Berbagi Tutorial Coding dan Pemrograman Komputer

Menu
  • Channel YouTube ThirteeNov
  • Channel YouTube Om Puter
Menu

Contoh kode HTML sederhana hitung mundur / countdown

Posted on 16 Mei 202516 Mei 2025 by OmPuter

Di bawah ini adalah kode html count down yang pernah dipakai di website ciihuy.com

<div style="background-color: black; padding: 1em; color: red;">
	<div style="display: table; width: 100%;">
		<div style="display: table-cell; vertical-align: middle;">
			<img src="https://ciihuy.com/wp-content/uploads/2025/03/countdown13.jpg" style="width: 128px;">
		</div>
		<div style="display: table-cell; vertical-align: middle; text-align: right;">
			<div id="countdown" style="font-size: 1.5em;"></div>
		</div>
	</div>
	
</div>
<script>
	function updateCountdown() {
						const targetDate = new Date("May 13, 2025 13:25:00").getTime();
						const now = new Date().getTime();
						const timeLeft = targetDate - now;

						if (timeLeft <= 0) {
    document.getElementById("countdown").innerHTML = 
        '<a href="https://www.youtube.com/watch?v=1trQXWQeBH0" target="_blank" style="' +
        'display: inline-block;' +
        'padding: 12px 24px;' +
        'background-color: #FF0000;' +
        'color: white;' +
        'text-decoration: none;' +
        'font-weight: bold;' +
        'font-size: 18px;' +
        'border-radius: 5px;' +
        'box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);' +
        'transition: all 0.3s ease;' +
        'text-align: center;' +
        '">' +
        'Tonton Trailer' +
        '</a>';
    return;
}

						const days = Math.floor(timeLeft / (1000 * 60 * 60 * 24));
						const hours = Math.floor((timeLeft % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
						const minutes = Math.floor((timeLeft % (1000 * 60 * 60)) / (1000 * 60));
						const seconds = Math.floor((timeLeft % (1000 * 60)) / 1000);

						document.getElementById("countdown").innerHTML = 
							`${days} hari ${hours} jam ${minutes} menit ${seconds} detik`;
					}

					updateCountdown();
					setInterval(updateCountdown, 1000);
</script>
Post Views: 270

Kategori

  • 3D Max
  • Adobe Animate
  • Android
  • c#
  • Cordova
  • HTML5, CSS & JavaScript
  • iOS
  • Lain-lain
  • Photoshop
  • PHP
  • Python
  • Roblox
  • Tak Berkategori
  • Unity
  • WordPress
ciihuy2020
© 2026 Om Puter | Powered by Superbs Personal Blog theme