primefalcon Posted April 29, 2007 Share Posted April 29, 2007 here's the script I'm trying to use: var framesetPage = "index.php";var currPage = justTheFilename(self.location.pathname);if (top.location == self.location && framesetPage != currPage) { self.location.replace(framesetPage + "?" + currPage);}window.onload = chgFrame;function chgFrame() { if (top.location == self.location && document.location.search) { var linkURL = justTheFilename(document.location.search); var contentWin = document.getElementById("content").contentWindow; var currURL = justTheFilename(contentWin.location.pathname); if (currURL != linkURL) { contentWin.location.replace(linkURL); } }}function justTheFilename(thisFile) { if (thisFile.indexOf("/") > -1) { thisFile = thisFile.substring(thisFile.lastIndexOf("/")+1); } if (thisFile.indexOf("?") == 0) { thisFile = thisFile.substring(1); } return thisFile;} the way it works is it whena page loads without the navigation frame in a framed website, it will call the nagication frameset, and then load the page that was found in the content area.and I've got it working fine if the all the files are in the same folder location, though in subfolders I cant seem to find a solution to thus.Anyone have any idea how to get around this little problem? Link to comment Share on other sites More sharing options...
jesh Posted May 1, 2007 Share Posted May 1, 2007 If you had the following directory structure: /wwwroot index.html page1.html/wwwroot/images image1.jpg image2.gif image3.jpg/wwwroot/somesubdirectory page2.html/wwwroot/somesubdirectory/anotherdirectory page3.html You could use relative paths to always start at to the root directory ("wwwroot" in this case) by preceding the URL with a "/".So, in "page3.html", if you wanted to put one of the images on your page, you could reference it like so: <img src="/images/image3.jpg" /> Then, if you wanted to link to "index.html", "page1.html" (both in the root directory) and to "page2.html", you could do so like this: <a href="/index.html">index</a><a href="/page1.html">page1</a><a href="/somesubdirectory/page2.html">page2</a> Perhaps you could use that in your navigation code. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.