VBBRett
asked on
Javascript hyperlinks
Hello, I am looking to use javascript hyperlinks and as opposed to linking directly to the site and using the http://www.thissite.com/thislink/ formation, I would prefer to use a reference to the local files no matter where it the site is. How would I do that? Here is an example of one of the lines that I would like to change:
pageMenu_23.addMenuItem("A bout Braces","location='http://www.blahblah.com/d/topic1/about-us'");
How would I change this to a link that refers to a file that is one of the local files no matter where the site is located? Thanks!
pageMenu_23.addMenuItem("A
How would I change this to a link that refers to a file that is one of the local files no matter where the site is located? Thanks!
ASKER
can you just put folder/page.htm as opposed to /folder/page.htm?
If you do that, it will assume relative to the current directory, not the root of the site.
For example: lets say the current page is http://www.test.com/something/page.htm
folder/page.htm would be http://www.test.com/something/folder/page.htm
/folder/page.htm would be http://www.test.com/folder/page.htm
Thanks.
For example: lets say the current page is http://www.test.com/something/page.htm
folder/page.htm would be http://www.test.com/something/folder/page.htm
/folder/page.htm would be http://www.test.com/folder/page.htm
Thanks.
ASKER
OK, I see. How about if you are at a link say the following:
http://www.rootdirectory.com/folder/page.html
and from page.htm, you want to reach the following link:
http://www.rootdirectory.com/topic/page.html, how would you go to topic/page.html?
http://www.rootdirectory.com/folder/page.html
and from page.htm, you want to reach the following link:
http://www.rootdirectory.com/topic/page.html, how would you go to topic/page.html?
As long as it is in the root (aka right after .com)
/topic/page.html
Just to give you more options, .. means up a directory, for example
../topic/page.html
would mean go up a directory, then into the folder topic, then page.html
If you were on this page: http://www.rootdirectory.com/folder/anotherfolder/page.html
and you used the link: ../topic/page.html
it would go to: http://www.rootdirectory.com/folder/topic/page.html
/topic/page.html
Just to give you more options, .. means up a directory, for example
../topic/page.html
would mean go up a directory, then into the folder topic, then page.html
If you were on this page: http://www.rootdirectory.com/folder/anotherfolder/page.html
and you used the link: ../topic/page.html
it would go to: http://www.rootdirectory.com/folder/topic/page.html
ASKER
So how do you go to the root directory from http://www.rootdirectory.com/folder/anotherfolder/page.html
if you wanted to go to the following:
http://www.rootdirectory/differentfolder/differenttopic/page.html?
if you wanted to go to the following:
http://www.rootdirectory/differentfolder/differenttopic/page.html?
Are you looking at a "URL Rewriting" (http://en.wikipedia.org/wiki/Rewrite_engine) solution ?
-Kusala
-Kusala
ASKER
Not necessarily so. I would like to manually do this so that I can just redirect the links to the appropriate place. Thanks!
http://www.rootdirectory/differentfolder/differenttopic/page.html?
Than use this
/differentfolder/different topic/page .html
If it start with a slash, it a assumed that it right after the domain name.
Than use this
/differentfolder/different
If it start with a slash, it a assumed that it right after the domain name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
/folder/page.htm
This will make the browser assume
http://www.thedomainthispageison.com/folder/page.htm
Thanks.