Cannot set property 'src' of null in JavaScript -
i'm in middle of changing existing javascript code exports images inside html document word document. new functionality going capture canvas data inside html, convert .png , export i'm getting 'cannot set property 'src' of null' when code reaches part:
//capture canvas data var canvasdata = markup.find('canvas'); var tempimage = new image(); ////array hold of images var imagearray = array(); (var = 0; < canvasdata.length; i++) { tempimage.src = canvasdata[i].todataurl("image/png"); imagearray[i] = tempimage; tempimage = null; }
any appreciated!
as can see nullifying tempimage inside loop, after first iteration assigned null value, in next iteration you'll trying set src null. why getting error. take var tempimage = new image();
inside loop.
(var = 0; < canvasdata.length; i++) { var tempimage = new image(); tempimage.src = canvasdata[i].todataurl("image/png"); imagearray[i] = tempimage; tempimage = null; }
Comments
Post a Comment