[Javascript] Includes and relative paths? -- followup
Hassan Schroeder
hassan at webtuitive.com
Tue Jul 3 11:26:55 CDT 2001
databarn wrote:
> The "path" I'm talking about is the link in a menu item references.
> For example,
> new menuItem('Home','code/js/default.asp');
> where Home is the menu label, and "code/js/default.asp" is the path
> relative to the web root.
>
> Now, if I include that menu on a page that is at "code/asp/calendar/weekly",
> what will happen?
Then the path to that menu option will look like
code/asp/calendar/weekly/code/js/default.asp
... and that's probably not what you want :-)
If you want to use the same menu code in every page, regardless of
its location in your directory structure, you should make the paths
absolute: /code/js/default.asp
It's no different than any other reference to any external object
(images, links) - all are interpreted relative to the page they're
contained in *unless* they start with a "/".
Hope that clarifies ...
--
H*
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ---(+1) 408-938-0567 --- http://www.webtuitive.com
-- creating dynamic Web sites and applications since 1994 --
More information about the Javascript
mailing list