html 获取当前域名,js获得当前url,javascript获取当前页面url值,js获取域名
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 );
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 );
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 );
还没有评论,来说两句吧...