Copie o código do código da seguinte forma:
<!doctypehtml>
<html>
<cabeça>
<title>tela dClock</title>
</head>
<corpo>
<canvas id = "relógio" largura = "500px" altura = "200px">
Seu navegador é muito antigo, atualize-o!
</canvas>
<tipo de script = "texto/javascript">
var relógio = document.getElementById("relógio");
var cxt = clock.getContext("2d");
//mostra o relógio digital
função showTime(m, n) {
cxt.clearRect(0, 0, 500, 500);
var agora = nova data;
var hora = now.getHours();
var min = agora.getMinutes();
var sec = now.getSeconds();
var msec = now.getMilliseconds();
hora = hora >= 10 ? hora : "0" + hora;
min = min >= 10 ? min : "0" + min;
seg = seg >= 10 seg: "0" + seg;
mseg = (mseg >= 10 && mseg < 100) ? ("0" + mseg): (mseg >= 0 && mseg < 10) ? ("00" + mseg): mseg;
bdigital(m, n, hora);
bdigital(m + 160, n, min);
bdigital(m + 320, n, seg);
//tdigital(m + 480, n, mseg);
//Exibição de três dígitos
função tdigital(x, y, num) {
var ge = num% 10;
var shi = (parseInt(num/10))% 10;
var bai = parseInt((parseInt(num / 10)) / 10) % 10;
digital(x, y, bai);
digital(x + 70, y, shi);
digital(x + 140, y, ge);
}
//Exibição de dois dígitos
função bdigital(x, y, num) {
var ge = num% 10;
var shi = (parseInt(num/10))% 10;
digital(x, y, shi);
digital(x + 70, y, ge);
}
//pintura:
//entre horas e minutos
cxt.lineWidth = 5;
cxt.strokeStyle = "#000";
cxt.fillStyle = "#000";
cxt.beginPath();
cxt.arc(m + 140, n + 80, 3, 0, 360, falso);
cxt.fill();
cxt.closePath();
cxt.stroke();
cxt.lineWidth = 5;
cxt.strokeStyle = "#000";
cxt.fillStyle = "#000";
cxt.beginPath();
cxt.arc(m + 140, n + 100, 3, 0, 360, falso);
cxt.fill();
cxt.closePath();
cxt.stroke();
//entre minutos e segundos
cxt.lineWidth = 5;
cxt.strokeStyle = "#000";
cxt.fillStyle = "#000";
cxt.beginPath();
cxt.arc(m + 300, n + 80, 3, 0, 360, falso);
cxt.fill();
cxt.closePath();
cxt.stroke();
cxt.lineWidth = 5;
cxt.strokeStyle = "#000";
cxt.fillStyle = "#000";
cxt.beginPath();
cxt.arc(m + 300, n + 100, 3, 0, 360, falso);
cxt.fill();
cxt.closePath();
cxt.stroke();
//Um entre segundos e milissegundos.
//cxt.lineWidth = 5;
//cxt.strokeStyle = "#000";
//cxt.fillStyle = "#000";
//cxt.beginPath();
//cxt.arc(m + 460, n + 100, 3, 0, 360, falso);
//cxt.fill();
//cxt.closePath();
//cxt.stroke();
}
//mostra um dígito
função digital(x, y, num) {
//Definir estilo
cxt.lineWidth = 5;
cxt.strokeStyle = "#000";
//um
função a() {
cxt.beginPath();
cxt.moveTo(x, y);
cxt.lineTo(x + 50, y);
cxt.closePath();
cxt.stroke();
}
//b
função b() {
cxt.beginPath();
cxt.moveTo(x + 55, y + 5);
cxt.lineTo(x + 55, y + 55);
cxt.closePath();
cxt.stroke();
}
//c
função c() {
cxt.beginPath();
cxt.moveTo(x + 55, y + 60);
cxt.lineTo(x + 55, y + 110);
cxt.closePath();
cxt.stroke();
}
//d
função d() {
cxt.beginPath();
cxt.moveTo(x + 50, y + 115);
cxt.lineTo(x, y + 115);
cxt.closePath();
cxt.stroke();
}
//e
função e() {
cxt.beginPath();
cxt.moveTo(x - 5, y + 110);
cxt.lineTo(x - 5, y + 60);
cxt.closePath();
cxt.stroke();
}
//f
função f() {
cxt.beginPath();
cxt.moveTo(x - 5, y + 55);
cxt.lineTo(x - 5, y + 5);
cxt.closePath();
cxt.stroke();
}
//g
função g() {
cxt.beginPath();
cxt.moveTo(x, y + 57,5);
cxt.lineTo(x + 50, y + 57,5);
cxt.closePath();
cxt.stroke();
}
//0
função zero() {
a();
}
//1
função um() {
b();
}
//2
função dois() {
a();
}
//3
função três() {
a();
}
//4
função quatro() {
b();
}
//5
função cinco() {
a();
}
//6
função seis() {
a();
}
//7
função sete() {
uma();
}
//8
função oito() {
a();
}
//9
função nove() {
a();
}
//Número n
número da função (n) {
mudar (n) {
caso 0: zero();
caso 1: um();
caso 2: dois();
caso 3: três();
caso 4: quatro();
caso 5: cinco();
caso 6: seis();
caso 7: sete();
caso 8: oito();
caso 9: nove();
}
}
número(num);
}
showTime(1, 45);
setInterval("showTime(1,45)", 1000);
</script>
</body>
</html>