my code stock.com

Html y javascript de una cuenta regrasiva con auto direccion al momento de llegar a 0.

Snippet options

Download: Download snippet as cuenta-regresiva.html.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<!DOCTYPE html>
<!-- 
Autor javascript: http://countdown.onlineclock.net/
Modificación javascript y autor html: Webempresa
Descripción : Archivo de cuenta regresiva, copiar en la raíz o en alguna carpeta del sitio web.
-->
<html lang="es">
<head>
	<meta charset="utf-8">
	<title>Cuenta Regresiva</title>

		<script type="text/javascript">
			
			//cambiar configuración
			
			año=2020;
			mes=1;
			dia=1;
			hora=1;
			minuto=0;
			segundo=0;
			urlsitio = 'http://www.tusitio.com/'; //url del sitio web final			

			dateFuture = new Date(año, mes-1 , dia, hora, minuto, segundo);		
			window.onload=function(){GetCount();}
		
		</script>
		
		
		<style type="text/css">
			
			/*cambiar estilos*/
			
			#contenedor{
				margin: 20px auto;
				width: 600px;
				text-align: center;
			}
			#textosuperior{
				margin-top: 20px;
				font-family: Arial;
				font-size: 20px;
				color: #f05152;
			}
			#countbox{
				font-size: 30px;
				font-family:Tahoma;
				background: #f05152;
				color: #fff;
				padding: 10px 0;
				margin: 20px auto 0;
			}
			#textoinferior{
				font-size: 10px;
				font-family: Arial;
				margin-top: 20px;
			}
			
		</style>
		
</head>
	<body>
		<div id="contenedor">
			<!--cambiar ruta logo-->
			<img src="logoempresa.jpg" />			
			
			<!--cambiar texto-->
			<div id="textosuperior">
				Cambiar el texto superior
			</div>

			<div id="countbox"></div>

			<!--cambiar texto-->
			<div id="textoinferior">
				Cambiar el texto inferior
			</div>
			
		</div>
	</body>
	
		<script type="text/javascript">
		// Codigo de http://countdown.onlineclock.net/
		function GetCount(){
		
		        dateNow = new Date();                                             
		        amount = dateFuture.getTime() - dateNow.getTime();                
		        delete dateNow;
		
		        if(amount < 0){
						location.href=urlsitio;
		        }
		        else{
		                days=0;hours=0;mins=0;secs=0;out="";
		
		                amount = Math.floor(amount/1000);
		
		                days=Math.floor(amount/86400);
		                amount=amount%86400;
		
		                hours=Math.floor(amount/3600);
		                amount=amount%3600;
		
		                mins=Math.floor(amount/60);
		                amount=amount%60;
		
		                secs=Math.floor(amount);
		
		                if(days != 0){out += days +" dia"+((days!=1)?"s":"")+", ";}
		                if(days != 0 || hours != 0){out += hours +" hora"+((hours!=1)?"s":"")+", ";}
		                if(days != 0 || hours != 0 || mins != 0){out += mins +" minuto"+((mins!=1)?"s":"")+", ";}
		                out += secs +" segundos";
		                document.getElementById('countbox').innerHTML=out;
		
		                setTimeout("GetCount()", 1000);
		        }
		}
		</script>
</html>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.