Web Analytics Made Easy -
StatCounter dynamic title for frameset page - CodingForum


No announcement yet.

dynamic title for frameset page

  • Filter
  • Time
  • Show
Clear All
new posts

  • dynamic title for frameset page

    This should be an easy one, but I can't come up with the answer. I have a page coded in HTML like so:

    <TITLE>My Database</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    self._domino_name = "_Welcome";
    // -->
    <FRAMESET ROWS="4*,96*">

    <FRAME NORESIZE NAME="top" SRC="http://www.mydomain.com/mydb.nsf/TopPage?OpenPage" SCROLLING=no>

    <FRAME NORESIZE NAME="bottom" SRC="http://www.mydomain.com/mydb.nsf/Page1?OpenPage" >

    The "TopPage" is a custom navigator function I've built in JavaScript, and when I click on a link to "Page2" in the top frame, "Page2" loads in the bottom frame. This works with no problems. However, what I want to do is dynamically generate a title for "FramePage" depending on what is loaded in the bottom frame. For example, when a user first loads this page, the title on the browser would read "My Database - Page1". When the user links to Page2, the title changes to "My Database - Page2".

    I've tried doing this using the native development tool (Lotus Domino), but so far haven't been succesful. How would I go about writing a JS function for this? Any advice is appreciated.


  • #2
    after the body tag

    doesn't work on NS4 (four) though.

    Alberto http://www.unitedscripters.com/


    • #3
      Switching Title in Frames Page

      I have a similar problem to the one stated above, but I've tried the code given and I can't get it to work.

      I am using a simple frameset two frames "contents" on the left for the navigation and "main" for the rest of the page.

      I want to dynamically change the <title> in the frameset page to that of the page that is currently in the "main" frame.

      I know very little about javascript so as well as the code I need to know where it goes, and in which document. e.g. "after the body tag" implies that it is in the framed page because there is no body tag within the frameset. It also doesn't tell me if it should be after the opening or closing body tag. (I tried all possible combinations with no success.)
      " 90% of everything is crud" - Theodore Sturgeon
      Filthy Beast - a 60's Rock Band


      • #4
        That code has to go in every page.

        If you want it in the frameset instead of every page use this. Put it anywhere in the head or body of the frameset.
        Change 'framename' as appropriate to the name of the frame that contains the title you want to display.

        <script type="text/javascript">
        function changeTitle()
           if (top.frames['framename'].document.title)
        Now, that assumes only one level of frames. If you're nesting, you need to change this structure:
        as appropriate.

        Now that you have that function, it needs to get called every time the document changes. So, add an onload handler to the frame that contains the doc you want the title of.

        NAME="bottom" SRC="http://www.mydomain.com/mydb.nsf/Page1?OpenPage"

        Try that. I don't have a 'set to putz with right now, so this is theoretical.

        If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
        Bored? Visit


        • #5
          Thank you NikkiH, That works a treat.
          " 90% of everything is crud" - Theodore Sturgeon
          Filthy Beast - a 60's Rock Band