您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页js获取当前地址JS获取当前URL的示例代码_javascript技巧

js获取当前地址JS获取当前URL的示例代码_javascript技巧

来源:化拓教育网


代码如下:


thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
strwrite = ""
strwrite += ""
strwrite += ""
strwrite += ""
document.write( strwrite );

thisDLoc = document.location;

thisURL = document.URL;

thisHREF = document.location.href;

thisSLoc = self.location.href;


thisTLoc = top.location.href;
thisPLoc = parent.document.location;
thisTHost = top.location.hostname;
thisHost = location.hostname;
strwrite = ""
strwrite += ""
strwrite += ""
strwrite += ""
document.write( strwrite );

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 ];
strwrite = ""
strwrite += ""
document.write( strwrite );
thisURL: [" + thisURL + "]
thisHREF: [" + thisHREF + "]
thisSLoc: [" + thisSLoc + "]
thisDLoc: [" + thisDLoc + "]
thisTLoc: [" + thisTLoc + "]
thisPLoc: [" + thisPLoc + "]
thisTHost: [" + thisTHost + "]
thisHost: [" + thisHost + "]
thisHPage: [" + thisHPage + "]
thisUPage: [" + thisUPage + "]

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务