SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript server.mappath equivalent

    I am using a location in my javascript: '../../myfolder/myfile.asp'

    I want to make the script reusable by pages in different folders. The 'myfolder' is in the root of my site. How can I target this from any other folder such as the vbscript server.mappath('myfolder/myfile.asp')?

    cheers

    monkey
    monkey - the rest is history

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In a file path or URL "./" means the current directory, "../" means the current directory's parent directory, and a relative path or URL starting with just a slash ("/") refers to web root (or the root file system directory for non-URL paths). You can do something like "../../example.ext" and "../../../example.ext".

    So try this:
    Code:
    /myfolder/myfile.asp
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Wizard boxhead's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    1,040
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    now why didn't i think of that?!

    Cheers
    monkey - the rest is history


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
  •