mystylecat
2016-04-02 21:46
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();
}
}
logo.onload = function(){
context.drawImage(loge,0,0,450,450);
drawChessBoard();
}
粗体那个 loge写错了 应该是logo
需要浏览器调试
没看出来代码哪里有错啊,是不是其他问题?
JS实现人机大战之五子棋(UI篇)
35650 学习 · 136 问题
相似问题