最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js获取url参数与路径方法
时间:2011-03-08 编辑:简简单单 来源:一聚教程网
js获取url参数与路径方法
如: http://localhost:8083/uimcardprjfunction getrootpath(){ //获取当
前网址,
如: http://localhost:8083/uimcardprj/share/meun.jsp
var curwwwpath=window.document.location.href; //获取主机地址之后的目
录,如: uimcardprj/share/meun.jsp
var pathname=window.document.location.pathname;
var pos=curwwwpath.indexof(pathname); //获取主机地址,
如: http://localhost:8083
var localhostpaht=curwwwpath.substring(0,pos); //获取带"/"的项目名,
如:/uimcardprj
var projectname=pathname.substring(0,pathname.substr(1).indexof('/')
+1);
return(localhostpaht+projectname);}
js参数表
网页特效
location property result
location.hash #test
location.host localhost:1351
location.hostname localhost
location.href http://localhost:1351/website1/dir/default.aspx/adsf?
id=12#test
location.pathname /website1/dir/default.aspx/adsf
location.port 1351
location.protocol http:
location.search ?id=12
-
上一个: iframe框架应用
相关文章
- js获取url链接中的域名、Url、相对路径和参数的例子 08-28
- js获取url中的参数 09-17
- js 获取url与url参数 11-01
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31