點評:微軟不大張旗鼓支持的技術我就不去嘗試,等微軟一說要支持了我就要嘗試了??赡苁歉④浀穆肪€走習慣了吧,不過想想挺傻的。
mvc是個好東西,為什么一入行的時候不去學一下,非要等到asp.net mvc出來了才去學;orm是個好東西,干嘛非要等到EF出來了才去學;html5是個好東西,干嘛非要等到IE9出來了才去學?......復制代碼
代碼如下:
<div>
<img src="http://www.49028c.com/uploads/allimg/130720/10022R603_0.jpg" />
<canvas>
<p>some info to tell the people whose broswer doesn't support html5</p>
</canvas>
</div>
復制代碼
代碼如下:
<div>
<canvas></canvas>
<canvas>
<p>some info to tell the people whose broswer doesn't support html5</p>
</canvas>
</div>
復制代碼
代碼如下:
window.addEventListener('load', function () {
// Get the canvas element.
var elem = document.getElementById('bg');
if (!elem || !elem.getContext) {
return;
}
// Get the canvas 2d context.
var context = elem.getContext('2d');
if (!context || !context.drawImage) {
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.49028c.com/uploads/allimg/130720/10022R603_0.jpg';
}, false);
//直接在文檔里拿下來的代碼 請注意為了opera和ie9 onload事件是必須要的,不然圖片會是一片空白,當然Chrome下不會這樣
新聞熱點
疑難解答