This article is mainly to JS get the current address JS get the current URL of the sample code is introduced, need friends can come to the reference, I hope to help you.
Code as follows: <table width=100% cellpadding=0 cellspacing=0 border=0 > <script language= "JavaScript" > Thisurl = document. url; Thishref = document.location.href; Thissloc = self.location.href; ThisDLoc = document.location;& nbsp Strwrite = "<tr><td Valign=top>thisurl: </td><td>[" + Thisurl + "]</td></tr>" Strwrite + + <tr><td valign=top>thishref: </td><td>["+ thishref +"]</td></tr& gt; " Strwrite + + <tr><td Valign=top>thissloc: </td><td>["+ Thissloc +"]</td></tr& gt; " Strwrite + + <tr><td Valign=top>thisdloc: </td><td>["+ Thisdloc +"]</td></tr& gt; " document.write (strwrite); </script> thisdloc = document.location; <BR> Thisurl = document. URL; <BR> thishref = document.location.href; <BR> Thissloc = self.location.href;<br> <scriptlanguage= "JavaScript" > thistloc = top.location.href; Thisploc = parent.document.location; Thisthost = top.location.hostname; Thishost = location.hostname; strwrite = "<tr><td valign=top >thistloc: </td><td>["+ Thistloc +"]</td></tr> " Strwrite + +" <TR><TD valign =top>thisploc: </td><td>["+ Thisploc +"]</td></tr> " Strwrite + +" <TR><TD Valign=top>thisthost: </td><td>["+ thisthost +"]</td></tr> " Strwrite + +" <tr> <TD valign=top>thishost: </td><td>["+ thishost +]</td></tr>" document.write ( Strwrite); </script> thistloc = top.location.href; <BR> thisploc = parent.document.location; <BR> thisthost = top.location.hostname; <BR> thishost = location.hostname;<br> <script language= "JavaScript" > Tmphpage = Thishref.split ("/"); Thishpage = tmphpage[tmphpage.length-1]; tmpupage = Thisurl.split ("/"); Thisupage = tmpUPage[TmpUP Age.length-1]; strwrite = "<tr><td valign=top>thishpage: </td><td>[" + thisHPage + "]< /td></tr> " Strwrite + +" <TR><TD valign=top>thisupage: </td><td>["+ ThisUPage + "]</td></tr>" document.write (strwrite); </script><tr><td>