Javascript 为什么不设置线宽?

Javascript 为什么不设置线宽?,javascript,html5-canvas,Javascript,Html5 Canvas,我正在制作弹跳球节目。 我想画墙并设置墙的线宽。 为了设置墙的线宽,我添加了“ctx.linewidth=30”;即 在我的代码中写第3行。 但什么也没发生。 我对线宽非常惊讶,所以我改变了ctx。线宽=50; 还是什么都没发生。 如何设置墙的线宽 function init() { ctx=document.getElementById('canvas').getContext('2d'); ctx.linewidth=30; ctx.fillStyle="rgb(200,0,50

我正在制作弹跳球节目。 我想画墙并设置墙的线宽。 为了设置墙的线宽,我添加了“ctx.linewidth=30”;即 在我的代码中写第3行。 但什么也没发生。 我对线宽非常惊讶,所以我改变了ctx。线宽=50; 还是什么都没发生。 如何设置墙的线宽

function init() {
  ctx=document.getElementById('canvas').getContext('2d');
  ctx.linewidth=30;
  ctx.fillStyle="rgb(200,0,50)";
  moveball();
  setInterval(moveball, 700);
}
function moveball() {
  ctx.clearRect(boxx,boxy,boxwidth,boxheight);
  moveandcheck();
  ctx.beginPath();
  ctx.arc(ballx,bally,ballrad,0,Math.PI*2,true);
  ctx.fill();
  ctx.strokeRect(boxx,boxy,boxwidth,boxheight);
  document.getElementById('px').value=ballx;
  document.getElementById('py').value=bally;

}

第3行的函数应该是
ctx.lineWidth
,而不是
ctx.lineWidth


带大写字母W.

Its
ctx.lineWidth
not
ctx.lineWidth
带大写字母WIndeed,仅供参考: