你的这个文件是怎么样指定的?
最好用<input type=file name=a>
这样可以得到:
a.value即是路径。

解决方案 »

  1.   

    我的意思是我有一个ACCESS的数据库文件,我是用javascrit或VBSCRIPT来操作本地的数据库,ADO连ACCESS是要写绝对路径的,然而我给人家用不好要人家改程序的路径,最好是拷贝到一个目录,然后就可以连数据库。
      

  2.   

    var fso ,f; //文件系统对象,文件对象
    var ScriptName;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    ScriptName=window.location.href;
    ScriptName=ScriptName.replace(/%20/," ");
    function GetFilePath(FileNameWithPath)
    {
    var pos;
    pos=FileNameWithPath.lastIndexOf("/");
    if(pos==-1) FileNameWithPath.lastIndexOf("\\");
    return FileNameWithPath.substring(0,pos);
    }alert(GetFilePath(ScriptName.substring(8));
      

  3.   

    这个
    <script language=jscript>
    var ScriptName;
    ScriptName=window.location.href;
    ScriptName=ScriptName.replace(/%20/," ");
    function GetFilePath(FileNameWithPath)
    {
    var pos;
    pos=FileNameWithPath.lastIndexOf("/");
    if(pos==-1) FileNameWithPath.lastIndexOf("\\");
    return FileNameWithPath.substring(0,pos);
    }alert(GetFilePath(ScriptName.substring(8)));
    </script>