js获取当前地址JS获取当前URL的示例代码_javascript技巧
来源:动视网
责编:小采
时间:2020-11-27 21:20:17
js获取当前地址JS获取当前URL的示例代码_javascript技巧
js获取当前地址JS获取当前URL的示例代码_javascript技巧: 代码如下: thisURL = document.URL; thisHREF = document.location.href; thisSLoc = self.location.href; thisDLoc = document.location; strwrite = thisURL: [ + thisURL + ] strwrite +=
导读js获取当前地址JS获取当前URL的示例代码_javascript技巧: 代码如下: thisURL = document.URL; thisHREF = document.location.href; thisSLoc = self.location.href; thisDLoc = document.location; strwrite = thisURL: [ + thisURL + ] strwrite +=

代码如下:
thisURL = document.URL;
thisHREF = document.location.href;
thisSLoc = self.location.href;
thisDLoc = document.location;
strwrite = "thisURL: | [" + thisURL + "] |
"
strwrite += "thisHREF: | [" + thisHREF + "] |
"
strwrite += "thisSLoc: | [" + thisSLoc + "] |
"
strwrite += "thisDLoc: | [" + thisDLoc + "] |
"
document.write( strwrite );
script>
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 = "thisTLoc: | [" + thisTLoc + "] |
"
strwrite += "thisPLoc: | [" + thisPLoc + "] |
"
strwrite += "thisTHost: | [" + thisTHost + "] |
"
strwrite += "thisHost: | [" + thisHost + "] |
"
document.write( strwrite );
script>
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 = "thisHPage: | [" + thisHPage + "] |
"
strwrite += "thisUPage: | [" + thisUPage + "] |
"
document.write( strwrite );
script>
js获取当前地址JS获取当前URL的示例代码_javascript技巧
js获取当前地址JS获取当前URL的示例代码_javascript技巧: 代码如下: thisURL = document.URL; thisHREF = document.location.href; thisSLoc = self.location.href; thisDLoc = document.location; strwrite = thisURL: [ + thisURL + ] strwrite +=
Top
|