HTML5 Canvas程序无法在Internet Explorer 8浏览器上绘制图像

时间:2015-08-17 17:14:06

标签: jquery html internet-explorer-8 html5-canvas

我创建了一个html5 canvas程序,它将图像复制到canvas对象中。将透明背景图像颜色更改为蓝色。该程序在Firefox和Chrome上正确运行。但我想将该程序运行到Internet Explorer 8。

计划:

<body>
<img id="my_img" src="https://cdn0.iconfinder.com/data/icons/classic-cars-by-cemagraphics/512/red_512.png" alt="The Image">
<canvas id="myCanvas" style="border:3px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.</canvas>
<script>
document.getElementById("my_img").onload = function() {
    var img = document.getElementById("my_img");
    var c = document.getElementById("myCanvas");
    var ctx = c.getContext("2d");
	c.width=img.width;
	c.height=img.height;
	ctx.rect(0,0,c.width,c.height);
	ctx.fillStyle="blue";
	ctx.fill();	
	ctx.drawImage(img, 0, 0);          
};
</script>
</body>

1 个答案:

答案 0 :(得分:1)

HTML5 canvas标记不支持Internet Explorer 8.它仅支持IE9及更高版本。

来源

http://www.w3schools.com/html/html5_canvas.asp

看看ls = ['a', 'b', 'c'] def abc(): k= ls.pop(0) ls.append(k) return k print abc() print abc() print abc() print abc() print abc() 虽然

https://github.com/arv/explorercanvas

要包含它,请添加此条件评论

explorercanvas