Draw with Javascript


#1

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


#2

Please post a link to the exercise. Thank you.


#3

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


#4

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


#6

Won't let me paste. "This text is displayed if your browser does not support HTML5 Canvas."


#8

What browser are you using, and on what device?


#9

Firefox. Windows 8.1


#10

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.


#11

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


#12

'Codecademy'

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


#13

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


#14

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


#15

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

```

#16

<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>


#17

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


#18

< !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


#19

OH there's nothing in it...it's blank


#20

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


#21

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

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


#22

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.