gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 04:54:31 24 4
gpt4 key购买 nike

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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com