urxlnc
02-03-2003, 09:32 AM
Well I think this is kinda simple thing but its messing me up,
Well I have a javascript file in the base directory.... for example.
abc\myjavascript.js
and I have five directories in the base directory. for example
abc\xy\
abc\ab\
abc\mno\
abc\yz\
abc\rs\
I have files with names 1.html, 2.html.... 12.html...114.html...
All files are marked with number and there are also files in triple digits
All the five directories
xy\
ab\
mno\
yz\
rs\
have the files 1.html.....444.html.... but with different versions.
i have a drop down menu in all the files in all the directories.
suppose, from the page of
abc\xy\3.html
if I choose mn version (from the list) the file to be loaded should be
abc\mno\3.html
Now I am almost done with the javascript but the problem thats is happeneing is,
when I choose mno version from
abc\xy\3.html
the file loading is
abc\xy\mno\3.html
where I want
abc\mno\3.html
I am using this script for that
var url = "mno/" + fileName ;
document.location.href = url;
What should I do? use substring to get the current location using document.location;
or is there any way to go down the directory tree from javascript?
and if i should use the substring, can anyone give me the syntax?
Also, I have problems finding the file name, as the file names differ in size... in the same directory the file names are from 1.html to 444.html how can I use substring function to get only the file name, either 1.html or or 23.html or 444.html
Thanks.
Well I have a javascript file in the base directory.... for example.
abc\myjavascript.js
and I have five directories in the base directory. for example
abc\xy\
abc\ab\
abc\mno\
abc\yz\
abc\rs\
I have files with names 1.html, 2.html.... 12.html...114.html...
All files are marked with number and there are also files in triple digits
All the five directories
xy\
ab\
mno\
yz\
rs\
have the files 1.html.....444.html.... but with different versions.
i have a drop down menu in all the files in all the directories.
suppose, from the page of
abc\xy\3.html
if I choose mn version (from the list) the file to be loaded should be
abc\mno\3.html
Now I am almost done with the javascript but the problem thats is happeneing is,
when I choose mno version from
abc\xy\3.html
the file loading is
abc\xy\mno\3.html
where I want
abc\mno\3.html
I am using this script for that
var url = "mno/" + fileName ;
document.location.href = url;
What should I do? use substring to get the current location using document.location;
or is there any way to go down the directory tree from javascript?
and if i should use the substring, can anyone give me the syntax?
Also, I have problems finding the file name, as the file names differ in size... in the same directory the file names are from 1.html to 444.html how can I use substring function to get only the file name, either 1.html or or 23.html or 444.html
Thanks.