+ 2
Canvas drawing syntax doesn't support Sololearn in js section.
Canvas drawing syntax doesn't support Sololearn in js section. Why?
4 odpowiedzi
+ 7
can you show your code
+ 6
corrected code
window.onload = function(){
var cnvs = document.getElementById("can");
var c = cnvs.getContext("2d");
// you must write it inside a function
function draw() {
c.moveTo(20, 20);
c.lineTo(200, 20);
c.stroke();
}
draw(); // you must call the function to make it work
}
hope this help
+ 4
var cnvs = document.getElementById("can");
var c = cnvs.getContext("2d");
c.moveTo(20, 20);
c.lineTo(200, 20);
c.stroke();
+ 4
Use window.onload =function () {/*your code*/}