Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Can someone please help me with this script

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Location
    Thailand
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can someone please help me with this script

    Can someone please help me with this script. I don't know what's wrong with it and I have been over a dozen times but I can't seem to find any errors but all the same it doesn't print.


    <html>
    <head>
    <style type="text/css">
    body{ margin:40px; background:#666; }
    #my_canvas{ background:#FFF; border:#000 1px solid; }
    </style>
    <script>
    function draw() {
    var ctx = document.getElementById('my_canvas').getContext('2 d');
    ctx.moveTo(50, 50);
    ctx.lineTo(300, 50);
    ctx.arkTo(350, 50, 350, 100, 50);
    ctx.stroke();
    }
    window.onload = draw;
    </script>
    </head>
    <body>
    <canvas id="my_canvas" width="500" height="350"></canvas>
    </body>
    </html>


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Can someone please help me with this script

    JavaScript is not Java. There is a sub-forum for other languages. Perhaps a mod will move this for you.

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Location
    Thailand
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can someone please help me with this script

    Do you have a link for the Sub forum?
    many thanks

  4. #4
    Member Kewish's Avatar
    Join Date
    Apr 2013
    Location
    Australia
    Posts
    116
    Thanks
    10
    Thanked 17 Times in 14 Posts

    Default

    Could it be the missing parens after your method call to draw?

    window.onload = draw ();

  5. #5
    Junior Member
    Join Date
    Nov 2013
    Location
    Thailand
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Can someone please help me with this script

    Quote Originally Posted by Kewish View Post
    Could it be the missing parens after your method call to draw?

    window.onload = draw ();
    No, that wasn't the problem but thanks all the same.

Similar Threads

  1. hello world script. probably really basic help
    By chronicz in forum What's Wrong With My Code?
    Replies: 5
    Last Post: September 16th, 2013, 10:12 PM
  2. Help with my script
    By kuzbear in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 8th, 2013, 11:24 AM
  3. use readymade script in netbeans
    By ajaychhadwa in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: December 19th, 2012, 05:54 AM
  4. App needs to exec script
    By jocala in forum Android Development
    Replies: 0
    Last Post: July 5th, 2012, 09:01 PM
  5. Java Script or HTML
    By ravi9999 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 1st, 2012, 09:44 AM