Mega Code Archive

 
Categories / JavaScript Tutorial / Location
 

Location pathname

The pathname property represents the pathname portion of the URL. For example, the pathname for http://www.rntsoft.com/pictures/index.htm is "/pictures/index.htm". <html>     <head>     <title> Using the pathname property of the Location object</title>     </head>     <body>     <script language="JavaScript">     <!--     function show(){          alert(document.location.pathname);     }     -->     </script>     <form name="form1">     Click the button to get the current location.pathname value of the following address:     <br>     http://www.rntsoft.com     <br>     <input type="button" name="getLoc" value="Get pathname" onClick='show()'>     <br>     </form>     </body>     </html>