[英]excanvas IE8, Unexpected call to method or property access
Hi I am getting an error on IE8 which is "Unexpected call to method or property access." 嗨,我在IE8上收到一个错误,该错误是“意外调用方法或属性。” at the line "foo.appendChild(canvas);" 在“ foo.appendChild(canvas);”行中 My codes are as follows. 我的代码如下。
<canvas id="foo" class="canvasstyle" height="300" width="300"></canvas>
var foo = document.getElementById("foo");
var canvas = document.createElement('canvas');
canvas.setAttribute("width", 300);
canvas.setAttribute("height", 300);
foo.appendChild(canvas);
canvas= G_vmlCanvasManager.initElement(canvas);
var ctx = canvas.getContext('2d');
ctx.save();
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.translate(canvas.width / 2, canvas.height / 2);
ctx.drawImage(server, -112, -120);
ctx.rotate(x2 * Math.PI / 180);
ctx.drawImage( point, -198, -80 );
ctx.restore();
Does anybody have any idea how to get rid of this error and work canvas on IE8. 有谁知道如何摆脱这个错误并在IE8上使用canvas。 Thank you for your help... 谢谢您的帮助...
I think that there is a good chance that your issue is that you are inserting a canvas into another canvas... I cannot think of a legitimate reason for this and because anything inside of a canvas element is only visible in browsers that do not support canvas, it is certainly in violation of the intended use. 我认为您的问题很有可能是您正在将一个画布插入另一个画布中……我无法想到一个合理的原因,因为canvas元素内部的任何内容仅在不支持的浏览器中可见画布,肯定违反了预期用途。
This is the intended use: 这是预期用途:
<canvas width="600" height="400">
Your browser can't handle our site and it looks very outdated... Try installing
<a href="https://chrome.google.com">one that doesn't suck</a>.
</canvas>
On any browser that supports canvas the message inside will not display. 在任何支持画布的浏览器上,都不会显示该消息。 Try inserting your canvas into another element. 尝试将画布插入另一个元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.