SwitchContent.htm
http://www.dynamicdrive.com/dynamici...tchcontent.htm
I have been trying to set up SwitchContent.htm so that all of the code in the Head section is located in a folder in a JavaScript file named “expand.js” so that I can call it from any page in any folder in my web. This works fine because the call I use expresses the location of the JavaScript file as a relative address and FrontPage (which I am using to build my site) modifies that relative address depending on the location of the calling page.
The images, “expand.gif” and “contract.gif” are in the same directory as the “expand.js” file. Is there a way that I can call them from the JavaScript that will work no matter where the calling page is located? If I don’t use a pathname and assume that the graphics files are in the same place as the “expand.js”, the graphics don’t appear. When I use a specific pathname on my disk-based web, everything is fine. But then the code doesn’t work on my real http site. If I use a specific pathname to my http site, the code works there.
I would like to determine whether my JavaScript code is running on my local drive in a disk-based web or on my http site in an IIS-based web. Is there a command that can tell my JavaScript code where my site is currently running? I am hoping that I can then use an “if” statement to determine this and change the pathname to find the correct location of graphics accordingly.
If there is an easier way, please let me know. I am just starting to work with JavaScript and need some help.
Thanks.
Kathy



Reply With Quote

Bookmarks