以下為JS獲取幾種URL地址的方法
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( "/" );
tmpUPage = thisURL.split( "/" );
thisUPage = tmpUPage[HmpUPage .length-1 ];
程式碼如下: