window.location ??  document.title ??......

解决方案 »

  1.   

    <script>
    var str=location.href;
    alert(str.substr(str.lastIndexOf("/")+1))
    </script>
      

  2.   

    同意 qiushuiwuhen(秋水无恨)
      

  3.   

    alert(document.location.lastIndexOf.substr(document.location.lastIndexOf("/")+1));
      

  4.   

    alert(location.href.replace(/(.+)\//,"")) 
      

  5.   

    可是
    haha.html?me="tom"&you="lucy"
    只想得到haha.html
      

  6.   

    alert(location.pathname.replace(/(.+)\//,""))
      

  7.   

    对于本地路径无效果.... 
    得到的结果"/G:/Documents%20and%20Settings/***/Local%20Settings/Temp/nonA.htm"能否写个通用的? 本地 / Web 都能获取...?
    另外.. 对于 URL .. 还得考虑 %20 ... 毕竟文件名是允许有空格的.
      

  8.   

    不知这样是不是算完事了?... 秋水大大再改进改进...<SCRIPT LANGUAGE="JavaScript">
    var path=location.pathname;
    alert((path.search(/\\/)!=-1)?path.replace(/(.+)\\/,"").replace(/(%20)/ig," "):path.replace(/(.+)\//,"").replace(/(%20)/ig," "));
    </SCRIPT>
      

  9.   

    <script>
    alert(location.pathname.replace(/(.+)[\\/]/,""))
    </script>