Jump to content

Gvinblad

Neophyte
  • Posts

    1
  • Joined

  • Last visited

Gvinblad's Achievements

Explorer

Explorer (1/14)

0

Reputation

  1. <!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Untitled 1</title> <style> </style> </head> <body onload="ad()"> <p id="ad"></p> <canvas id="ctx" width="1200" height="800"></canvas> <script> var canvas = document.getElementById("ctx"); var ctx= canvas.getContext("2d"); ctx.fillStyle = "rgb(20, 184, 255)"; ctx.fillRect(100, 100, 300, 200); ctx.fillStyle = "rgb(255,255,255)"; ctx.fillRect(130, 130, 240, 80); ctx.beginPath(); ctx.fillStyle = "black"; ctx.arc(150, 260, 22, 0, 2 * Math.PI, true); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.fillStyle = "red"; ctx.arc(250, 260, 22, 0, 2 * Math.PI, true); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.fillStyle = "green"; ctx.arc(350, 260, 22, 0, 2 * Math.PI, true); ctx.closePath(); ctx.fill(); ctx.beginPath(); ctx.moveTo(320,340); ctx.lineTo(350,300); ctx.lineTo(380,340); ctx.lineTo(320,340); ctx.closePath(); ctx.fillStyle = "rgb(20, 184, 255)"; ctx.fill(); ctx.beginPath(); ctx.moveTo(120,340); ctx.lineTo(150,300); ctx.lineTo(180,340); ctx.lineTo(120,340); ctx.closePath(); ctx.fillStyle = "rgb(20, 184, 255)"; ctx.fill(); function ad() { var date = new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); if (hours < 10) hours = "0" + hours; if (minutes < 10) minutes = "0" + minutes; if (seconds < 10) seconds = "0" + seconds; document.getElementById("ad").innerHTML = hours + ":" + minutes + ":" + seconds; setTimeout("ad()", 1000); } </script> </body> </html> Надо что бы часы отображались в белом прямоугольнике. Надо поменять координаты часов. Заранее благодарен
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy