JavaScript DHTML/GUI Components/Canvas

Материал из Web эксперт
Перейти к: навигация, поиск

A Canvas Containing a Simple Chart (Firefox)

   <source lang="html4strict">
 

<html> <head> <title>canvas Object</title> <script type="text/javascript"> function draw() {

   var canvas = document.getElementById("chart"); 
   if (canvas.getContext) { 
   var context = canvas.getContext("2d"); 
   context.lineWidth = 20; 
   
   context.strokeStyle = "red"; 
   context.beginPath(); 
   context.moveTo(20, 90); 
   context.lineTo(20, 10); 
   context.stroke(); 
   
   } 

} </script> <style type="text/css"> canvas { border: 1px solid black; } </style> </head> <body onload="draw();">

canvas Object


<canvas id="chart" width="130" height="100"></canvas> </body> </html>


 </source>