我有一個在canvas上繪製矩形的腳本函數。我想在「if」條件下清除長方形的繪製。 我在畫布上也有文字(它的座標是0,80),它不應該被清除。只有矩形必須清潔。清潔長方形
function red_stroke_2(yy)
{
//Red color edges
context.strokeStyle = "#f00";
context.strokeRect(0,yy,800,40);
}
if (Option1==answers[qnumber])
{
red_stroke_2(80);
}
context.clearrect?你在嘗試嗎? – 2013-03-09 12:13:44