Draw with Javascript

I don’t even see a Q&A section for this…but can someone explain the issue??

Please post a link to the exercise. Thank you.

https://www.codecademy.com/courses/web-beginner-en-SWM11/0/2?curriculum_id=50b91eda28c2fb212300039e#

1 Like

Now can we see your script please (in a post, not a picture).

Won’t let me paste. “This text is displayed if your browser does not support HTML5 Canvas.”

What browser are you using, and on what device?

Firefox. Windows 8.1

https://www.google.ca/search?q=browser+support+‘canvas’

Firefox 44 and 45 are not supported, apparently. Seems kind of weird. I haven’t read any of the pages in the serp, yet. I’m using FF 45 in Windows 7 with no issues.

I also tried in current version of Chrome. I guess IE? So it’s the browser not Code Academy?

‘Codecademy’

Can’t really say. Seems to be fine on this end. Is there another computer you can try logging in on?

Yeah I’ll try one that is running Windows 7. So what I have is correct? It’s just the site/browser? I mean it’s what they wrote so that’s why I didn’t understand why it isn’t working, lol

I haven’t seen your javascript yet so can’t tell you if it is correct or not. Please post your script.js code.

I see what’s happening. You were trying to paste in the HTML. No, CC won’t let you paste in raw HTML, but it will let us if we mark it down as a code sample.

<!DOCTYPE html>
<html>
</html>

Just enter on a new line, three back-ticks followed by language (lowercase, no space), and on another new line, three more backticks, like so,

```html
and paste your code in here
```
<head>

    <title>Let's Draw!</title>

    <link rel='stylesheet' type='text/css' href='stylesheet.css'/>

</head>

<body>

    <var my_canvas = document.method("ID");

    <canvas id="canvas" width="200" height="200">

        This text is displayed if your browser does not support HTML5 Canvas.
    </canvas>

    <script type='text/javascript' src='script.js'></script>

</body>

That’s the HTML. We still need to see the SCRIPT.JS file.

< !DOCTYPE HTML>
< html>

Don’t know why it left that out, and I just tried on a different computer (Windows 7) with Firefox and still didn’t work

OH there’s nothing in it…it’s blank

Now we’re getting somewhere. Read and follow the instructions and write the two lines of code in that tab.

I put
var my_canvas=document.method(“ID”);

TypeError: document.method is not a function. I’ve never worked with jquery’s before

Fortunately, you don’t need to. This is core JavaScript.

Create a variable, my_canvas, and set it equal to the result of calling .getElementById() on document. You should pass your canvas’ ID of 'canvas' as an input to your method.

The key is write ‘canvas’ instead of “ID”. and .getElementById, not .method.