0
As <script > tag is no longer valid in HTML5, how can I use <canvas> tag?
9 ответов
+ 8
You were making syntax error. There should be moveTo. See the fixed code
https://code.sololearn.com/W4x2fPb0nD97/?ref=app
+ 7
JS is case sensitive. Take care of case.
+ 6
Coffee☕Underrun Me too. It is just hilarious.
+ 6
Script tag works perfectly in SoloLearn. You may have done some other mistake. Post your code so that we can help.
+ 5
Script tag is valid in html5
You can use script tag.
+ 3
Ok . I will try again.
+ 2
Nobody have told me .I have tried script in Solo-code-play-platform. It was showing eror again and again.
+ 1
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<canvas id="mycanvas" width="200" height="100"
style="border:1px solid #d3d3d3;"></canvas>
<script>
var canvas=document.getElementById("mycanvas");
var ctx=canvas.getContext("2d");
ctx.moveto(0,0);
ctx.lineto(200,100);
ctx.stroke();
</script>
</body>
</html>
This was the code
Code play saying that there is no "moveto" method.
+ 1
Ok. So JAVASCRIPT isn't case insensitive, is it?