function drawcircle(id,x,y,r){ var ca = document.getElementById(id); var cans = ca.getContext("2d"); cans.globalCompositeOperation = "destination-out"; cans.beginPath(); cans.arc(x,y,r,0,Math.PI*2); //解決兼容 ca.style.display = ‘none’; ca.offsetHeight; ca.style.display = ‘inherit’; //解決兼容 cans.fillStyle="#000"; cans.fill(); } 這樣能夠解決
參考自:http://bbs.csdn.net/topics/390808206java