畫棋盤怎么怪怪的
window.onload=function(){ ????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();? ???????? ????} }
為什么我的棋盤是這樣的,寬和高都是450px呀!
2016-09-11
應(yīng)該是你電腦屏幕顯示設(shè)置的問(wèn)題,換個(gè)屏幕顯示像素比試試 ?
2016-09-11
canvas的寬和高要在標(biāo)簽里寫,我寫到css上了,所以錯(cuò)了,最后發(fā)現(xiàn)的!謝謝