IE支持canvas标签


使用excanvas.js可以让IE支持Html5的canvas标签,具体用法如下:

 1 <html>
 2 <head>
 3     <title></title>
 4     <!--[if IE]>
 5 <script type="text/javascript" src="excanvas.js" onload="explorercanvasload"></script>
 6     <![endif]-->
 7 </head>
 8     <body>
 9         <canvas id="canvas" width="400" height="300"></canvas>
10         <script type="text/javascript">
11             window.onload = function() {
12                 var ctx = document.getElementById("canvas").getContext("2d");
13                 ctx.fillRect(10, 10, 20, 20);
14             };
15         </script>
16     </body>
17 </html>

需要注意一点,使用时一定要在onload之后.

示例请见:canvasexplorer-box2d示例 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM