我有以下代码:
function createImage(source) {
var pastedImage = new Image();
pastedImage.onload = function() {
}
pastedImage.src = source;
}
Run Code Online (Sandbox Code Playgroud)
函数 createImage 包含包含图像源的源参数。之后,我创建了类 Image 的对象 pasteedImage 并在警告我正在获取像[object HTMLImageElement].
我的问题是如何使用该对象将图像显示到我的 html 页面中。我想在 onload 功能后显示它。
提前致谢。