Results 1 to 3 of 3

Thread: Why isn't this program working?

Hybrid View

  1. #1
    Join Date
    Feb 2014

    Why isn't this program working?

    I put the following into textedit on mac and saved as an html doc. When I tried to open, it is a blank screen. It is supposed to draw a car and have it move across.

    HTML Code:
    <!DOCTYPE html>
    // position of the car
    var x = 11;
    var draw = function() {
        background(252, 255, 214);
        // draw the car body
        fill(255, 0, 115);
        rect(x, 200, 100, 20);
        rect(x + 15, 178, 70, 40);
        // draw the wheels
        fill(77, 66, 66);
        ellipse(x + 25, 221, 24, 24);
        ellipse(x + 75, 221, 24, 24);
        x = x + 10;
    Thank you!

  2. #2
    Join Date
    Mar 2011
    First of all, I suspect that you've omitted an external JavaScript file that contains all of the drawing functions. There's certainly quite a bit of additional code that's missing as well since there's nothing that would animate the display or anything that would provide a place for it to be drawn.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Mar 2007
    HTML is not complete, you need a head and a body and your using Canvas is I am not mistaken, therefore you need to have a canvas object to refer to and external scripting as suggested above.
    STOP using $ prefix on JavaScript variable names...
    Please remember to wrap any code you have in forum tags:-

    [CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]

    If you can't think outside the box, you will be trapped forever with no escape...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles