嗨,我有一個關於動態創建使用JavaScript的畫布的問題。HTML5動態創建畫布
我創建這樣一個帆布:
var canvas = document.createElement('canvas');
canvas.id = "CursorLayer";
canvas.width = 1224;
canvas.height = 768;
canvas.style.zIndex = 8;
canvas.style.position = "absolute";
canvas.style.border = "1px solid";
但是當我試圖找到它,我得到一個null
值:
cursorLayer = document.getElementById("CursorLayer");
我是不是做錯了?有沒有更好的方式來使用JavaScript創建畫布?
的[添加帆布與JavaScript的網頁(http://stackoverflow.com/questions/9152224/add-canvas-to-a-page-可能的複製用-javascript) – Vadzim