效果出不來
var?dom?=?document.getElementById("clock"); var?ctx?=?dom.getContext('2d'); var?width?=?ctx.canvas.width; var?height?=?ctx.canvas.height; var?r?=?width/2; ????function?drawBackground(){ ???? ???ctx.translate(r,r); ???ctx.beginPath();???//起始路徑 ???ctx.lineWidth?=?10; ???ctx.arc(0,?0,?r-5,?0,?2*Math.PI,?false); ???ctx.stroke();??//繪制圓??fill()填充圓 ??????} ???drawBackground();
2017-03-09
js代碼沒有問題 看看你是不是HTML頁面寫錯了 你可能忘記引入你這個JS了 ?還有IE9以下的不支持的哦