本篇文章主要是对JS获取几种URL地址的方法进行了总结介绍,需要的朋友可以过来参考下,希望对大家有所帮助
以下为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 ];
以上就是JS获取几种URL地址的方法小结的详细内容,更多请关注0133技术站其它相关文章!
未经允许不得转载:0133技术站首页 » JavaScript 教程