[code]
/**
* …canvas嵌套
* @author amyflash.com
*/

(function() {
var ctx = document.getElementById(“canvas”).getContext(“2d”);

var canvas2 = document.createElement(“canvas”);

canvas2.width =200;
canvas2.height =200;
var ctx2 = canvas2.getContext(“2d”);
ctx2.fillStyle=”#0000FF”;
ctx2.strokeStyle=”#000000″;
ctx2.lineWidth =10;
ctx2.fillRect(0,0,200,200);
ctx2.strokeRect(0,0,200,200);

ctx.drawImage(canvas2,10,10);
})();
[/code]