Here's the answer. Use ResolveUrl. I think I'll up the point value to 500 and reward them to myself....
menu1.push('<a href=<%=ResolveUrl("~/_NDC
Main Topics
Browse All TopicsHere's the story....
I have an ASP.net MasterPage in my root directory. The MasterPage has a menu. The menu has references to .aspx files in subdirectories. The menu references are built by Javascript but render HTML. The javascript is stored in a .js file and referenced by the MasterPage. When the Masterpage envokes one the .aspx content pages in a subdirectory, the menu no longer references the correct path to the files in the subdirectories. I've determined its becuase the MasterPage looses reference to the root directory when one of the subdirectories' .aspx file is envoked. I've had to change all my <img> references on the MasterPage to account for this. However, I can't get the menu to work.
My questions is how can I reference the Root directory in Javascript. I've included code snippets of what I have tried.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: JeffreymarcumPosted on 2008-04-11 at 07:57:21ID: 21334854
What i really need to do is create a variable and assign it the root directory location and then tack on the subdirectory (E.G. varRootDir + "/subfolder/page.aspx) Does anyone know how to get the root directory in JS ( I know its NOT document.location.toString ();)