URL of current directory

 

 

<SCRIPT LANGUAGE="JavaScript">

// general purpose function to extract URL of current directory

function getDirPath(URL) {
     var result = unescape(URL.substring(0, (URL.lastIndexOf("/")) + 1));

     return result;
}

// handle button event, passing work onto general purpose function

function showDirPath(URL) {
     alert(getDirPath(URL));
}

</SCRIPT >

<FORM>
     <INPUT TYPE="button" VALUE="View directory URL"
       onClick
="showDirPath(location.href)">
</FORM>