现在上传图片没有问题,就是图片显示的时候,想用相对路径来显示图片这样就可以在不同的服务器上部署都没有影响,但是写的相对路径翻译到编辑器中还是全路径,请问怎么解决啊?
我的意思是上传时写的是相对路径例如:
<IMG alt=log.jpg src="../help/images/log.jpg">
前台能够正确显示,但是再查看当前html信息时又变为全路径了:
<IMG alt=log.jpg src="http://localhost:8080/cvbs/techfrm/help/onlinehelp/help/images/log.jpg">
请问怎么解决啊???

解决方案 »

  1.   

    不会的啊 我测试过了 因为一旦上传html里就记录下了全路径了。
      

  2.   

    现在就是服务器不固定啊,所以只能用相对路径显示图片啊,不会受服务器影响呀
    检查了一下午发现一个怪问题:
    [code]
    var filePath = path.substring(path.indexOf("techfrm"));
      //filePath = "<%=WebRoot%>"+filePath;
      filePath = "../"+filePath.substring(filePath.lastIndexOf("help"));
      //alert("filePath==>"+filePath);
      imgHtml = "<img alt='"+name+"' src='"+filePath+"' />";
      var content = window.opener.HtmlEdit.document.body.innerHTML;
    content = content+imgHtml;
    window.opener.HtmlEdit.document.body.innerHTML=content;
    content2 = window.opener.HtmlEdit.document.body.innerText;
    alert(content2);
    [/code]
    window.opener.HtmlEdit.document.body.innerHTML=content;  content里图片是相对路径,执行这个赋值后,取html信息看alert出的content2就是带全路径的了,咋回事啊!!!