Canvas is new to me - so I need help.
I have a function that draws data retrieved using getImageData () - on an existing canvas or newly created.
I need to make it possible for a newly created canvas to give it a unique id. However, when I try the following - the canvas is created but the id is undefined.
function drawImageData(img, t1, t2, cc, scale, targetCanvas, userId) {
var canvas = targetCanvas || document.createElement('canvas');
if(!targetCanvas){
canvas.setAttribute('id', userId);
// the rest of the code
}
How to properly assign userId - to "id" canvas?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.