畫棋盤怎么怪怪的
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
應該是你電腦屏幕顯示設置的問題,換個屏幕顯示像素比試試 ?
2016-09-11
canvas的寬和高要在標簽里寫,我寫到css上了,所以錯了,最后發現的!謝謝