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 ( using 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

    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:


    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. Advertisements

  2. Shawn McNiven

    Evertjan. Guest

    Shawn McNiven wrote on 13 mrt 2005 in comp.lang.javascript:
    Evertjan., Mar 13, 2005
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.