Forum Moderators: open
This is what is happening. I'm linking a button within a flash page to a separate file containing a frameset (a topFrame and a mainFrame). This flash page acts as an intro/home page and won't be used much after the user is within the site. A new navigation system within the frameset, topFrame, will then be the primary nav system.
frameset is "secFrameset"
topFrame is "topFrame"
bottomFrame is "mainFrame"
I applied this code and all seems to work well except one item, the document.write()code in the frameset main page "secFrameset". Please note that my javascript capabilities are almost null.
<html>
<head>
<title>secFrameset</title>
</head>
<script language="JavaScript" type="text/javascript">
origURL = parent.document.URL
contentURL = origURL.substring(origURL.indexOf('?')+1, origURL.length)
document.write('<frameset rows="122,*" cols="*" framespacing="0" frameborder="NO" border="0"><frame src="topFrame.htm" name="topFrame" frameborder="no" scrolling="NO" bordercolor="#FFFFFF"><frame src="services.htm" name="mainFrame" frameborder="no" scrolling="auto" bordercolor="#FFFFFF"><frame src="' + contentURL + '" name="content"><\/frameset>')
</script>
</html>
I have several orphan pages, Ex. services.htm, about.htm, etc., designated to the mainFrame, and I don't know the correct way to list the additional pages in the "document.write(). I have tried several different ways and nothing works.
A special thanks in advance for your help.
There is some good news here -- the way this javascript works is that there is no need to change ANYTHING to have it work for an indefinite number of potentially orphaned content pages. Just customize it once for your specific frames layout and that's it.
Here's the logic for this approach. There are two scripts: one you place on each and every potentially orphaned page and one you use in the frameset document.
1. The script for each content page checks to see if the page is in a frameset. If it is orphaned, then the script redirects to the frameset page instead, but it also appends its own url at the end in a query string, after the "?"
So each page that has the orphan script running will append its own URL to the tail end of the frameset.
Here's that script:
passpage = document.URL
if (top.location == self.location)
top.location.href="master.html?" + passpage
2. The second script is on the frameset page - this is the code you have in your post. This script strips the "content page" information off the end of the full URL and creates contentURL. The frameset's document.write() sets the src attribute to contentURL, which should automatically be the orphaned page's address. You don't need to change the docuemnt.write() script at all.
Just make sure you have the first script installed on every possible orphaned page. Then your links can be set directly to the content page's URL with no concern for the parent frameset at all.