document.location.href.match(/.+\/(.*)/)[1]

解决方案 »

  1.   

    用asp代码可以吗?Request.ServerVariables("URL")
      

  2.   

    to:fason(咖啡人生) 谢谢
    这样的话查询的参数也读出来,能不能参数也不要阿?正则不懂望再指教,谢谢了
      

  3.   

    如果是struts等框架结构的程序
    http://localhost:8080/xxxx/xxx.do?xxx=xxx&xxx=xxx
    这样又怎么取呢
      

  4.   

    alert(window.location.href.match(/\/([^\?/]*)(\?|$)/)[1])