IE9下html5初试小刀

2020-04-22 07:30:55易采站长站整理

return;
}
// Create a new image.
var img = new Image();
// Once it’s loaded draw the image on the canvas.
img.addEventListener(‘load’, function () {
// Original resolution: x, y.
context.drawImage(this, 0, 0);
// Now resize the image: x, y, w, h.
context.drawImage(this, 160, 0, 120, 70);
// Crop and resize the image: sx, sy, sw, sh, dx, dy, dw, dh.
context.drawImage(this, 8, 20, 140, 50, 0, 150, 350, 70);
}, false);
img.src = ‘http://www.sh1800.net/NavPic/20100917.jpg’;
}, false);
//直接在文档里拿下来的代码 请注意为了opera和ie9 onload事件是必须要的,不然图片会是一片空白,当然Chrome下不会这样

未完待续….
原文地址 http://www.cnblogs.com/ice6/archive/2010/09/18/1830020.html