感觉不太对....为什么我的代码和老师的一模一样,可是运行不出来填充效果呢
var canvas = document.getElementById("canvas");
canvas.width=1024;
canvas.height=768;
var context = canvas.getContext("2d");
context.moveTo(100,100);
context.lineTo(700,700);
context.lineTo(100,700);
context.lineTo(100,100);
context.fillStyle="rgb(2,100,30)";
//content.fill();
context.lineWidth=5;
context.strokeStyle="red";
context.stroke();一把注释打开,就什么都显示不出。。。。求大神帮忙看看怎么回事。。。。