Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb how to setup a variable from a folder name??

    Hi
    I need some help editing a javascript to get a variable from a folder name.
    Lets say:

    var numRes = 15;
    var partnerId = 123456;
    var rndStr = Math.random()*100000;

    What I need is to make the partnerId variable to be exactly as the folder name that contains the html with the javascript.
    To be more clear, let say that the html file containing this javascript is located in a folder like: www.mydomain.com/56789/javafile.html
    So the partnerId should be
    var partnerId = foldername (in this case 56789)

    So what I need is to know how to read the folder name and place it as the partnerId variable.

    Thanks in advance

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    São Paulo, Brazil
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to do this on serverside...
    /Daniel

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Danne
    You need to do this on serverside...
    Not necessarily so...

    var partnerId = top.location.href.match( /\.com\/([^/]+)\// )[1];
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  

    Posting Permissions

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