javascript - 用于动态创建 Canvas 元素的 Excanvas

标签 javascript canvas excanvas

Excanvas“for enternet Explorer”对于预定义的 Canvas 元素工作正常。但是当涉及到在脚本中动态创建canvas元素时,就不行了...

有什么想法吗??

最佳答案

来自 the documentation :

If you have created your canvas element dynamically it will not have the getContext method added to the element. To get it working you need to call initElement on the G_vmlCanvasManager object.

var el = document.createElement('canvas');
G_vmlCanvasManager.initElement(el);
var ctx = el.getContext('2d');

关于javascript - 用于动态创建 Canvas 元素的 Excanvas,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1635419/

相关文章:

javascript - 出现在 Canvas 上的随机形状

Android - 触摸绘图

javascript - Canvas 到高分辨率图像

javascript - excanvas drawimage 不适用于 IE8

javascript - 如何在 ui-sref 中转义 UI 路由器参数

javascript - 样式化日期时间-本地日历清除按钮

php - 如何在页面加载时使用 ajax 将 php include 加载到页面中

javascript - 在 ChartJS 中 chop Canvas 标签,同时在工具提示中保留完整的标签值

javascript - “G_vmlCanvasManager”未定义

html - SVG 矩形与 div 与 Canvas