Results 1 to 3 of 3

Thread: Why isn't this program working?

  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.

  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.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

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