0
我正在使用JavaScript来解析XML文件。其中一个XML属性是链接到图像的URL。例如。 http://localhost/pic.jpgJavaScript使用字符串变量作为URL插入图像
随着解析的继续,我使用一个变量来保存每个URL(这是一个字符串变量),并希望我可以在一个表中显示这些图像。
以下是我的代码部分:
for(i = 0; i < row.length; i++)
{
// looping through the XML file
var Logo1 = row[i].getElementsByTagName("Logo")[0].childNodes[0].nodeValue;
//Logo1 is the string which is a URL
document.write("<img src= 'Logo1' width='256' height='128'>");
}
我使用的是Chrome,但图像不会加载.... enter image description here
有人能帮忙吗?
它的工作!不够感谢你! – DawnZHANG