
Francisco Ezequiel Ferreyra
PreguntaEstoy teniendo un error en Java.La variable d en lienzo no la lee. Dejo el codigo de java para ver el error
var d = document.getElementById("dibujito"); var lienzo = d.getContext("2d"); console.log(lienzo);

Sara Lucia Diaz Puerta
Hola, a mi en la consola me dice esto:
Uncaught TypeError: lienzo.strokeStyle is not a function at dibujo.js:5

Romina Alberdi
Uncaught TypeError: Cannot read property ‘getContext’ of null " var lienzo = d.getContext(“2d”);
Si les da este error, revisen cómo escribieron el id.... que sea "Dibujito" y no "dibujito" o a la inversa.
Javier Aznar Caudevilla
A mi me pasa lo mismo o algo parecido. Me da este error Uncaught TypeError: Cannot read property 'getContext' of null " var lienzo = d.getContext("2d");
var d = document.getElementById("Dibujito"); var lienzo = d.getContext("2d"); lienzo.beginPath(); lienzo.strokeStyle = "red"; lienzo.moveTo(100, 100); lienzo.lineTo(200, 200); lienzo.stroke(); lienzo.closePath();