Problema con Reloj, Ayuda!!
Publicado por Besstiia (6 intervenciones) el 09/05/2008 23:56:49
Hola a todos,
Tengo que hacer una reloj que además de mostrar la hora muestre unas rayas. El tema es que tengo el código casí hecho, pero no sé que es lo que está mal. ¿Me pueden ayudar?
Muchas gracias de antemano.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Reloj -->
<html>
<head><title>Reloj</title>
</head>
<body >
<br><center><hr><h1>Reloj</h1><br><br>
<script language="JavaScript" type="text/javascript">
<!--
// Cada segundo invoca la funcion Dibuja()
setInterval("Dibuja()",1000);
function Dibuja()
{
var Ahora = new Date();
var Horas = Ahora.getHours(); // Tengo que meterlo dentro de la funcion para que se actualice el valor, ya que es llamado por el interval
var Minutos = Ahora.getMinutes();
var Segundos = Ahora.getSeconds();
var rayas = new string ("-----------------------------------------------------------");
document.write (Ahora);
document.FormularioReloj.TextoHoras.value = Horas + 'h';
document.FormularioReloj.DibujoHoras.value = rayas.substring(0, Horas);
document.FormularioReloj.TextoMinutos.value = Minutos + 'm';
document.FormularioReloj.DibujoMinutos.value = rayas.substring(0, Minutos);
document.FormularioReloj.TextoSegundos.value = Segundos + 's';
document.FormularioReloj.DibujoSegundos.value = rayas.substring(0, Segundos);
}
//-->
</script>
<form name="FormularioReloj" action="">
<table border="0">
<tr>
<td> <input type="text" name="TextoHoras" size="3" value='0h'></td>
<td ><input type=text name="DibujoHoras" size="24" ></td>
</tr>
<tr>
<td> <input type="text" name="TextoMinutos" size="3" value='0m'></td>
<td ><input type=text name="DibujoMinutos" size="60" ></td>
</tr>
<tr>
<td> <input type="text" name="TextoSegundos" size="3" value='0s'></td>
<td ><input type=text name="DibujoSegundos" size="60" ></td>
</tr>
</table>
</form>
</center><br><hr>
</body>
</html>
Tengo que hacer una reloj que además de mostrar la hora muestre unas rayas. El tema es que tengo el código casí hecho, pero no sé que es lo que está mal. ¿Me pueden ayudar?
Muchas gracias de antemano.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- Reloj -->
<html>
<head><title>Reloj</title>
</head>
<body >
<br><center><hr><h1>Reloj</h1><br><br>
<script language="JavaScript" type="text/javascript">
<!--
// Cada segundo invoca la funcion Dibuja()
setInterval("Dibuja()",1000);
function Dibuja()
{
var Ahora = new Date();
var Horas = Ahora.getHours(); // Tengo que meterlo dentro de la funcion para que se actualice el valor, ya que es llamado por el interval
var Minutos = Ahora.getMinutes();
var Segundos = Ahora.getSeconds();
var rayas = new string ("-----------------------------------------------------------");
document.write (Ahora);
document.FormularioReloj.TextoHoras.value = Horas + 'h';
document.FormularioReloj.DibujoHoras.value = rayas.substring(0, Horas);
document.FormularioReloj.TextoMinutos.value = Minutos + 'm';
document.FormularioReloj.DibujoMinutos.value = rayas.substring(0, Minutos);
document.FormularioReloj.TextoSegundos.value = Segundos + 's';
document.FormularioReloj.DibujoSegundos.value = rayas.substring(0, Segundos);
}
//-->
</script>
<form name="FormularioReloj" action="">
<table border="0">
<tr>
<td> <input type="text" name="TextoHoras" size="3" value='0h'></td>
<td ><input type=text name="DibujoHoras" size="24" ></td>
</tr>
<tr>
<td> <input type="text" name="TextoMinutos" size="3" value='0m'></td>
<td ><input type=text name="DibujoMinutos" size="60" ></td>
</tr>
<tr>
<td> <input type="text" name="TextoSegundos" size="3" value='0s'></td>
<td ><input type=text name="DibujoSegundos" size="60" ></td>
</tr>
</table>
</form>
</center><br><hr>
</body>
</html>
Valora esta pregunta


0