SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    Arizona
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Directory Path (Navigation)

    IT's not my script, have taken it from CodeLance. It prints out the
    Directory Path (Navigation) I am having simple search and replace
    problems with the output of this script.

    It prints out when called from a certain directory:

    www.mydomain.com > directory1 > go_down_further > last%20directory

    I want to replace the root or www.mydomain.com with just "HOME" and

    IF POSSIBLE: "_" "%20" (underscores & spaces) should be replaced as
    well with simple spaces (not as _ and %20)

    P.S. I am not a java programmer at all.

    TIA.
    Zeshan.



    <script language="JavaScript">
    <!--
    // Set the varible g_url to nothing
    var g_url = "";

    // Split the document url by the /
    var split_url=document.URL.split('/');

    // Loop thorough the splits starting after http://
    // and ending on the parent directory of the current document
    for (var i=2; i<split_url.length-1; i++)
    {
    // Start rebuilding the url to link each level
    g_url = g_url + split_url[i] +"/";
    document.write("<a href='http://" + g_url +"'>" + split_url[i]
    + "</a>");

    // Check to see if the last directory was written to avoid
    // and extra > after the parent directory of the current page
    if (i != split_url.length-2)
    { document.write(" > "); }

    // end loop
    }


    </script>

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,489
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    // Split the document url by the /
    url=unescape(document.URL)
    var split_url=url.split(/');


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •