0

As <script > tag is no longer valid in HTML5, how can I use <canvas> tag?

5th Apr 2019, 2:35 AM
Mohammad Bayezid
Mohammad Bayezid - avatar
9 Antworten
+ 8
You were making syntax error. There should be moveTo. See the fixed code https://code.sololearn.com/W4x2fPb0nD97/?ref=app
5th Apr 2019, 5:47 AM
Arushi Singhania
Arushi Singhania - avatar
+ 7
JS is case sensitive. Take care of case.
5th Apr 2019, 6:05 AM
Arushi Singhania
Arushi Singhania - avatar
+ 6
Coffee☕Underrun Me too. It is just hilarious.
5th Apr 2019, 3:14 AM
Arushi Singhania
Arushi Singhania - avatar
+ 6
Script tag works perfectly in SoloLearn. You may have done some other mistake. Post your code so that we can help.
5th Apr 2019, 4:40 AM
Arushi Singhania
Arushi Singhania - avatar
+ 5
Script tag is valid in html5 You can use script tag.
5th Apr 2019, 2:46 AM
Arushi Singhania
Arushi Singhania - avatar
+ 3
Ok . I will try again.
5th Apr 2019, 4:41 AM
Mohammad Bayezid
Mohammad Bayezid - avatar
+ 2
Nobody have told me .I have tried script in Solo-code-play-platform. It was showing eror again and again.
5th Apr 2019, 4:38 AM
Mohammad Bayezid
Mohammad Bayezid - avatar
+ 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.
5th Apr 2019, 5:18 AM
Mohammad Bayezid
Mohammad Bayezid - avatar
+ 1
Ok. So JAVASCRIPT isn't case insensitive, is it?
5th Apr 2019, 5:53 AM
Mohammad Bayezid
Mohammad Bayezid - avatar