JS获取当前网址,JS获取当前域名URL ,JS获取网站完整路径页面地址
发布:半支烟 | 发布时间: 2009年6月3日1.获取当前完整网址
<script type="text/javascript">
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
strwrite = " thisURL:
strwrite += " thisHREF:
strwrite += " thisSLoc:
strwrite += " thisDLoc:
document.write( strwrite );
2.获取当前域名信息
thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
strwrite = "
strwrite += " thisPLoc:
strwrite += " thisTHost:
strwrite += " thisHost:
document.write( strwrite );
3.获取当前页面
<script type="text/javascript">
tmpHPage = thisHREF.split( "/" );
thisHPage = tmpHPage[ tmpHPage.length-1 ];
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[ tmpUPage.length-1 ];
strwrite = " thisHPage:
strwrite += " thisUPage:
document.write( strwrite );
- 相关文章:
中国国内八家域名注册商优缺点比较 (2009-5-29 1:59:3)
什么是域名,如何为自己的企业网站选择好的域名 (2009-5-26 21:25:18)
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。






收藏本文: 






















