Web Analytics Made Easy -
StatCounter crossbrowser issue in framesets? - CodingForum

Announcement

Collapse
No announcement yet.

crossbrowser issue in framesets?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • crossbrowser issue in framesets?

    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?

  • #2
    set the document.title property of your frameset window:
    Code:
    top.document.title = "hello world";
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

    Comment

    Working...
    X