var img = "<img src='/images/FileTypeIcon/' >"
比如这样 我可能赋值给某个控件 不知道是ie还是其它什么原因, 会自动给你加上域名信息 变成http://www.aa.com/images/... 好恼火哦我不希望这样,万一以后域名有变化,那怎么办啊,我只想保存路径信息我是在修改fckeditor,上传附件同时加上附件类型的图标的时候 遇到的兄弟们,有没办法啊?

解决方案 »

  1.   

    location.href=http://www.aa.com/images/index.html 
    location.pathname=/images/index.html  //用pathname 试试
      

  2.   

    在你的页面中不要加,basePath,也就是删掉设置路径的脚本
    如:
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <base href="<%=basePath%>">
      

  3.   

    最简单的就是你给img加一个自定义属性
    比如url='images/1.jpg'
    然后用id.getAttribute('url')来获取