按照步骤写代码,最后水印没有出现,棋盘也没有了。
var chess = document.getElementById('chess');
var context = chess.getContext('2d');
context.strokeStyle = "#BFBFBF";
var logo = new Image();
logo.src = "images/1.png";
logo.onload = function(){
context.drawImage(loge,0,0,450,450);
drawChessBoard();
}
var drawChessBoard = function(){
for(var i=0;i<15;i++){
context.moveTo(15+i*30,15);
context.lineTo(15+i*30,435);
context.stroke();
context.moveTo(15,15+i*30);
context.lineTo(435,15+i*30);
context.stroke();
}
}