<script language="javascript">
str="http://localhost:8080/a/b/c/d/e/test.jsp"
var a = str.match(/^(http:\/\/.[^\/]*)(.*?)([^\/]*)$/);
alert(a[1])
alert(a[2])
alert(a[3])
</script>
str="http://localhost:8080/a/b/c/d/e/test.jsp"
var a = str.match(/^(http:\/\/.[^\/]*)(.*?)([^\/]*)$/);
alert(a[1])
alert(a[2])
alert(a[3])
</script>
<script language="javascript">
str="http://localhost:8080/a/b/c/d/e/test.jsp"
var a = str.match(/^(http:\/\/.[^\/]*)(.*[\/])([^\/]*)$/);
alert(a[1])
alert(a[2])
alert(a[3])
</script>
function get(str) //从链接地址里提取出本文档名
{
alert(str.match(/\/([^\?/]*)(\?|$)/)[1])
}
get(location.href)
get("http://www.xxxx.com/xxx/xxx.htm")
get("http://www.xxxx.com/xxx/xxx.htm?text1=abcde&text2=fghij")
</script>