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