在Alfresco中使用JavaScript无法在HTML文档中显示图像
我在javascript代码中定义了一个图像url:在Alfresco中使用JavaScript无法在HTML文档中显示图像,alfresco,alfresco-share,Alfresco,Alfresco Share,我在javascript代码中定义了一个图像url: var boxwidth = document.properties["sc:price"]; content += "<body align=\"center\"><font face= \"Comic sans MS\">"; content += "<b>Retail Price: </b>" + price + "<br><br>"; var urlStr = d
var boxwidth = document.properties["sc:price"];
content += "<body align=\"center\"><font face= \"Comic sans MS\">";
content += "<b>Retail Price: </b>" + price + "<br><br>";
var urlStr = document.assocs["sc:relatedDocuments"][0].url;
//image document url
var res = "http://hostname:port/share/proxy/alfresco/api/node/content/"+urlStr.substring(4);
document.content = content;
var-boxwidth=document.properties[“sc:price”];
内容+=”;
内容+=“零售价:“+Price+”
”;
var urlStr=document.assocs[“sc:relatedDocuments”][0]。url;
//图像文档url
var res=”http://hostname:port/share/proxy/alfresco/api/node/content/“+urlStr.子字符串(4);
document.content=内容;
我必须将此作为src属性传递给图像:
content += "<img src=\"'+res+'\" width = \"65px\" height = \"35px\"/>";
content+=”;
链接url的方式如下:
var str = "View Image";
var result = str.link(res);
content += result+"<br><br>";
var str=“查看图像”;
var结果=str.link(res);
内容+=结果+“
”;
但是我在HTML文档中看不到图像。有人能告诉你为什么会发生这种情况,还有什么办法吗?你确定你的当前用户有权访问该文档吗?你确定你建立了正确的URL吗?嗨@Gagravarr,是的,我绝对确定URL和权限。我以管理员身份登录并查看。我想,在将字符串传递给JavaScript时会出现一些问题。此外,在Alfresco中,JS的正常函数都不像innerHTML()或createElement()或getElementByTag()那样工作。