how to find website root path

Discussion in 'Javascript' started by Shawn McNiven, Mar 13, 2005.

  1. Hello,

    I have a problem with an application i'm working on (Asp.net using
    vb.net for developing). I'm normally used to doing middle tier
    development, so my javascript skills are not up to par. Here is my problem:

    I have a javascript file called 'PMP/Scripts/Popups.js' (pmp is the root
    of the website). In that file is the following function:

    function OpenTutorial(sTutID)
    {
    var sURL = '../support/tutorials.aspx?tutid=' = sTutID;
    var sProperties = 'center:yes;etc..';
    window.showModalDialog(sURL, self, sProperties);
    }

    where ../support is acutally pmp/support.

    Most of the website pages are located in sub folders from the root of
    the website. When editing is to be done on a record, a popup window is
    called from the main page. the popup pages are in another sub folder
    (i.e. pmp/review would be where review.aspx resides and the edit page
    would be located at pmp/review/popups). We give the user a tutorial
    icon to click on which calls the OpenTutorial function on a button click
    event.

    The problem is the tutorial popup page won't load properly when called
    from another popup page. I've tried variations of location.href,
    location.pathname, location.hostname etc.. but can't seem to get the
    pages to open correctly. The most common error i get is that the url is
    not correct. here is a sample of the urls being called by the function:

    pmp/review/support/tutorials.aspx
    pmp/feedback/support/tutorials.aspx
    pmp/thirdparty/support/tutorials.aspx.

    Any suggestions on how i can get the function to point to
    pmp/support/tutorials.aspx regardless of where the function is being
    called from?

    Thanks in advance
    Shawn McNiven
    Shawn McNiven, Mar 13, 2005
    #1
    1. Advertising

  2. Shawn McNiven

    Evertjan. Guest

    Shawn McNiven wrote on 13 mrt 2005 in comp.lang.javascript:

    > Any suggestions on how i can get the function to point to
    > pmp/support/tutorials.aspx regardless of where the function is being
    > called from?
    >


    /pmp/support/tutorials.aspx


    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
    Evertjan., Mar 13, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    1,203
  2. yburtin
    Replies:
    2
    Views:
    625
    yburtin
    Oct 26, 2004
  3. Rick Osborn
    Replies:
    10
    Views:
    3,943
    Jon A. Cruz
    Feb 8, 2004
  4. hector
    Replies:
    5
    Views:
    401
    CBFalconer
    Dec 5, 2006
  5. AAaron123
    Replies:
    11
    Views:
    8,936
    AAaron123
    Mar 30, 2009
Loading...

Share This Page