点评:微软不大张旗鼓支持的技术我就不去尝试,等微软一说要支持了我就要尝试了。可能是跟着微软的路线走习惯了吧,不过想想挺傻的。
mvc是个好东西,为什么一入行的时候不去学一下,非要等到asp.net mvc出来了才去学;orm是个好东西,干嘛非要等到EF出来了才去学;html5是个好东西,干嘛非要等到IE9出来了才去学?......复制代码
代码如下:
<div>
<img src="http://www.vevb.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.vevb.com/uploads/allimg/130720/10022R603_0.jpg';
}, false);
//直接在文档里拿下来的代码 请注意为了opera和ie9 onload事件是必须要的,不然图片会是一片空白,当然Chrome下不会这样
新闻热点
疑难解答