嗨我正在做一個繪圖應用程序使用畫布,但我不知道如何清除畫布。 我試過clearRect和其他功能,但他們不工作。 腳本的最後兩個函數應清除畫布,但他們沒有工作... (對不起我的英文不好) 下面的代碼:如何清除畫布?
function clear_canvas_width()
{
var s = document.getElementById ("scribbler");
var w = s.width;
s.width = 10;
s.width = w;
}
function clear_canvas_rectangle()
{
var canvas = $('#canvas')[0]; // or document.getElementById('canvas');
canvas.width = canvas.width;
}
可能重複[如何清除重繪帆布(http://stackoverflow.com/questions/2142535/how-to-clear-the-canvas-for-redrawing) – Prestaul