JS获取几种URL地址的方法小结
2016-01-31 17:14
513 查看
以下为JS获取几种URL地址的方法
复制代码 代码如下:
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];
复制代码 代码如下:
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];
相关文章推荐
- javascript console函数详解js开…
- js倒计时和js时钟
- ecshop transport.js和…
- 什么是JS事件冒泡?
- javascript38种小技巧,推荐新手查看
- javascript中的的getYear()问题
- Jsp 内置对象
- 重温JSP学习笔记--JSP动作标签
- json_encode 与 json_decode的区别
- 各种浏览器开启JavaScript脚本方法
- json城市下拉列表
- coco2d-js在HTML上可以运行,但是打包apk后会黑屏
- kafka + jstorm版本升级安装(三)
- 控制Checkbox全选的JS
- 控制Checkbox全选的JS
- 删除内容前弹出确认框的JS
- 在线浏览PDF之PDF.JS (附demo)
- javascript实现瀑布流效果
- 怎样用js得到当前页面的url信息方法(JS获取当前网址信息)
- Ubuntu下搭建MEAN.JS