关于图片文件的路径问题
我的代码是这样的:
//操作工具栏的关闭和打开
function switchSysBar(){
if (document.images.switchPoint.src=='images/titlebg_arrow_2.gif'){
document.images.switchPoint.src='images/titlebg_arrow_1.gif'
document.all("frmMenu").style.display=""
}
else{
document.images.switchPoint.src='images/titlebg_arrow_2.gif'
document.all("frmMenu").style.display="none"
}
}
目的是控制打开和关闭工具栏并用不同的图片来标示所处的状态。
但是图片路径却找不到(代码所在文件和images处在同一目录下,应该没问题吧!)
当我把代码改成:
function switchSysBar(){
if (document.images.switchPoint.src=='file:///D|/tomcat/webapps/main/images/titlebg_arrow_2.gif'){
document.images.switchPoint.src='file:///D|/tomcat/webapps/main/images/titlebg_arrow_1.gif'
document.all("frmMenu").style.display=""
}
else{
document.images.switchPoint.src='file:///D|/tomcat/webapps/main/images/titlebg_arrow_2.gif'
document.all("frmMenu").style.display="none"
}
}
却没有问题,不知道为什么,现我不想用文件的绝对路径,要用相对路径,请高手们看看该如何解决?