Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,846 questions

9,748 answers

573 users

How to draw line with JavaScript and HTML5

1 Answer

0 votes
<!DOCTYPE html>
<html>    
    <head>
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <title>Welcome to your computer...</title>                


        <script type="text/javascript">
            function drawLine()
            {
                var canvas = document.getElementById('mycanvas');

                if (canvas.getContext)
                {
                    var ctx = canvas.getContext('2d');

                    ctx.lineWidth = 3;
                    ctx.beginPath();
                    ctx.moveTo(0,0);
                    ctx.lineTo(500,0);
                    ctx.stroke();
                }
                else
                    alert('Browser not support HTML5.');
            }
        </script>
    </head>
    <body onload="drawLine();">
        <canvas id="mycanvas"></canvas>
    </body>
</html>  



answered Jun 7, 2014 by avibootz
edited Jun 7, 2014 by avibootz
...