作为 Javascript 代码的一部分,在获取 uri 后,我尝试从该 uri 获取图像,并将其插入到行开头的单元格中。下面是我的代码。这不起作用。我不知道我做错了什么/如何实现这一目标。我是否需要使用 XMLHttpRequest() 还是可以只使用源 uri 创建图像?有人可以帮忙吗?提前谢谢了!我也在代码中注释了。
var rowx =document.getElementById(rowid); //get that row that I want to insert image
var x =rowx.insertCell(0); //insert a cell
var uri= "baseuri"+rowid; //this is the uri where I get the image from
img = document.createElement('img');
img.scr= uri;
x.appendChild(img); //I tried x.innerHTML = img, but that didn't work either
最佳答案
我注意到的第一件事是你有 img.src
而不是 img.src
。
关于Javascript 显示来自 uri 的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33003102/