nlamont
10-03-2006, 04:57 PM
I am building a linear sequence of pages with forward and backward nav. Because they have to pass info from one page to another they're in a frameset.
I want the same title to appear on all the pages so I've put the title as a variable in the frameset. title="Mytitle"
I have a global.js which is loaded with every page and it contains a script to run certain functions on page load. One of these is a function addTitle() which is to take the variable from the frameset and put it into the appropriate div on the page. I did it at first with innerHTML
var titleplace=top.mainFrame.document.getElementById("sectionTitle")
title=parent.title
titleplace.innerHTML=title
This works in IE5.5 and 6 but not in Firefox or Opera. No error message but it just doesn't show anything.
I then tried with DOM scripting:
var titleplace=top.mainFrame.document.getElementById("sectionTitle")
title=parent.title
mazename=top.mainFrame.document.createTextNode(title)
titleplace.appendChild(mazename)
Same thing - no-show in FF or Opera, but OK in IE.
I've proved that the addTitle function is being run on pageload and it is getting the right value for title from the frameset. It just isn't putting it into the page.
OK, I could just hard-code it but this is to be a template for other apps so I'd like as much as possible scripted. I don't want anything specific in global.js as it should be reusable by anyone using the templates without them going into it.
Any suggestions?
I want the same title to appear on all the pages so I've put the title as a variable in the frameset. title="Mytitle"
I have a global.js which is loaded with every page and it contains a script to run certain functions on page load. One of these is a function addTitle() which is to take the variable from the frameset and put it into the appropriate div on the page. I did it at first with innerHTML
var titleplace=top.mainFrame.document.getElementById("sectionTitle")
title=parent.title
titleplace.innerHTML=title
This works in IE5.5 and 6 but not in Firefox or Opera. No error message but it just doesn't show anything.
I then tried with DOM scripting:
var titleplace=top.mainFrame.document.getElementById("sectionTitle")
title=parent.title
mazename=top.mainFrame.document.createTextNode(title)
titleplace.appendChild(mazename)
Same thing - no-show in FF or Opera, but OK in IE.
I've proved that the addTitle function is being run on pageload and it is getting the right value for title from the frameset. It just isn't putting it into the page.
OK, I could just hard-code it but this is to be a template for other apps so I'd like as much as possible scripted. I don't want anything specific in global.js as it should be reusable by anyone using the templates without them going into it.
Any suggestions?