View Full Version : how to setup a variable from a folder name??

02-25-2003, 10:07 PM
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

02-25-2003, 10:49 PM
You need to do this on serverside...

02-25-2003, 11:06 PM
Originally posted by Danne
You need to do this on serverside... Not necessarily so...

var partnerId = top.location.href.match( /\.com\/([^/]+)\// )[1];