為什么我的棋盤顯示不出來?
var chess=document.getElementById('chess');
var context=chess.getContext('2d');
context.strokeStyle="#bfbfbf";
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();
}
2016-04-03
你要讓文檔加載后才加載js ?如果放在頭部就在window。onload=function(){代碼都放這里}
要么把js放在canvas后 ?讓canvas創(chuàng)建了才畫圖
2016-04-06
我也不出來, 是因?yàn)槲野袹S寫在<head></head>標(biāo)簽里
2016-03-29
我的也是,請(qǐng)問你解決了沒有
2016-03-28
你看一下js文件是不是正確引用了