1
我正在使用excanvas.js庫來支持IE(以下9種)瀏覽器中的畫布功能。我目前面臨的問題是excanvas期望image作爲drawImage()方法的第一個參數。我發現它不會支持另一個畫布或視頻作爲第一個參數。什麼是實現此功能的解決方法?我的代碼是這樣的。使用excanvas在畫布上繪製圖像
var canvas1 = document.getElementById("canvas1"); // Get the first canvas Element
var canvas2 = document.getElementById("canvas2"); // Get the second canvas element
if (typeof G_vmlCanvasManager != 'undefined') {
canvas1 = G_vmlCanvasManager.initElement(canvas1); // Initialise with excanvas
canvas2 = G_vmlCanvasManager.initElement(canvas2);
}
if (canvas1.getContext) {
var ctx1 = canvas1.getContext("2d");
var ctx2 = canvas2.getContext("2d");
var img = new Image();
img.onload = function() {
ctx1.drawImage(this, 0, 0, 200, 200); // Draw the image on first canvas
ctx2.drawImage(canvas1, 0, 0, 200, 200); // Draw the image on to the second canvas using the first canvas
}
img.src = "image1.jpg";
}
它不適用於Ie8及以下瀏覽器。如何解決這個問題?
canvas.toDataURL();在較舊的IE瀏覽器中不支持 – KiranPalode
好的:o ......... – EricG