473,486 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

directing external.js to subdirectory

15 New Member
Is there a way in javascript to get the name of the file currently using an external.js?

If I have files named test.html, test2.html, test3.html, etc. and I want to get to a file in a subdirectory with the same name as the html file from an external js. Is there a way to do this?

This is the function in my external js that I want to be able to direct to the subdirectory with the same name as the html file currently using the external js.

Expand|Select|Wrap|Line Numbers
  1. function change2()
  2. {
  3.  
  4. top.parent.leftside.iframe1.location="test/file.html";
  5.  
  6. }
  7.  
  8.  
file.html has the same name in every subdirectory.
So I want this function to go to a subdirectory with the same name as the html page currently using the external js.

thanks in advance for any suggestions.
Sep 8 '10 #1
2 1210
darkfact
15 New Member
I came up with an answer to part of my question. I can get the file name with this code:

Expand|Select|Wrap|Line Numbers
  1. var file = location.href.substring(location.href.lastIndexOf('/')+1);
  2.  
  3.     var fileName =file.split('.');
  4.  
Now, if I can figure out how to use that information I'll be set.
Sep 8 '10 #2
darkfact
15 New Member
Well, it was actually pretty simple. It just took me a while to figure it out.
Expand|Select|Wrap|Line Numbers
  1.  
  2. function change2(){
  3. var file = location.href.substring(location.href.lastIndexOf('/')+1);
  4. var fileName =file.split('.',1);
  5. var gotoplaylist = [fileName] +  "/" + 'playlist.html';
  6.  
  7. top.parent.center.location="test4.html";
  8.  
  9. top.parent.leftside.iframe1.location.href = [gotoplaylist];
  10. }
  11.  
Sep 8 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1883
by: Bill | last post by:
Will IIS6.0 recognize a global.asa file located in a subdirectory on the webserver? I'd like a file that will execute whenever a file in the subdirectory is browsed - or, at least it is...
3
12796
by: allard poldermans | last post by:
How can I make a reference to an external CSS or JS file that is relative to the XSL stylesheet, and not relative to the XML data? If you simply put : <link rel="stylesheet" type="text/css"...
3
5740
by: eieiohh | last post by:
MySQL 3.23.49 PHP 4.3.8 Apache 2.0.51 Hi All! Newbie.. I had a CRM Open Source application installed and running. Windows Xp crashed. I was able to copy the contents of the entire hard...
18
7497
by: utab | last post by:
Dear all, I am making a system call to the well known Gnuplot with system("gnuplot"); gnuplot opens if I only supply this command but I would like to pipe that command line in my C++...
0
1591
by: furiousmojo | last post by:
Okay, so I thought this would be easy, but it's not turning out that way. Let's see how good you guys are! :-) I have a windows authentication-based Intranet application. An excerpt from the...
2
1718
by: keith | last post by:
I created a subdirectory in a project and added an image to the subdirectory from the project and set its property Build Action=Embedded Resource. Then instanciate a image by Image img=new...
5
18487
by: Stimp | last post by:
I've created a dll that I placed in my web application's 'bin' directory. I want to access the web.config file from this dll so that I can retrieve a node value. e.g. Dim oDoc As...
9
2854
by: silverburgh.meryl | last post by:
i am trying to use python to walk thru each subdirectory from a top directory. Here is my script: savedPagesDirectory = "/home/meryl/saved_pages/data" dir=open(savedPagesDirectory, 'r') ...
0
1533
by: =?Utf-8?B?Qm9ubmll?= | last post by:
I have a basic ASP / Index Server search page. I have a web site contained in a subdirectory in the root of a main web site. What I’m trying to do is force the search page in the subdirectory,...
4
3227
by: =?Utf-8?B?U0g=?= | last post by:
There seems to be an issue with .NET 3.5/Visual Studio 2008 (Team System). After convincing my company to create our latest project in .NET 3.5, this is kind of reflecting bad on me. Problem:...
0
7094
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6839
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4559
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.