Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the parent frame title from a child frame 1

Status
Not open for further replies.

kylua

Technical User
Sep 30, 2002
199
GB
Hi All

I am reasonably convinced that this cannot be done, but on the assumption that you should never assume anything, I'm going to ask anyway.

I have a frameset with a title frame, 2 navigation frames and a 'display' frame. I want the browser title bar text to change when the display frame changes without having to refresh the entire page. From what I can see, if this can be done, it is by calling a sub within the parent frame that changes the title of the window/document. But the property 'title', changes the pop up text!

If there is an answer, i would be grateful.

Colin
 
Looked into that.

The document.domain is the same anyway.

I have no problem calling subs from the parent frame, I just need to know how to make a sub change the browser Title Bar Caption.

Cheers
 
Ahh...

Hmm, it doesn't sound like your basic issue deals with domain security for cross-frame scripting. Instead maybe you are struggling with the DOM itself?

The frame can change the parent's
Code:
title
or it can call a parent's Sub.

Here is a sample:

testfr.htm
Code:
<html>
  <head>
    <script language=vbscript>
      Sub window_onload()
        MsgBox &quot;Hello, frame loaded!&quot;
        parent.document.title = &quot;Frame says: Boo!&quot;
        parent.Hello
      End Sub
    </script>
  </head>
  <body>
    ZZZZZZZZZZZZ<br>
    zzzzzzzzzzzz<br>
    zzzzzzzzzzzz<br>
    zzzzzzzzzzzz<br>
    zzzzzzz...<br>
    <br>
    Just some text.
  </body>
</html>
testpar.htm
Code:
<html>
  <head>
    <title>Hi, original title</title>
    <script language=vbscript>
      Sub Hello()
        MsgBox &quot;Hello, from parent sub&quot;
      End Sub
    </script>
  </head>
  <frameset cols=&quot;*&quot;>
    <frame src=&quot;testfr.htm&quot;>
  </frameset>
</html>
Maybe this is what you were after?
 
That did the trick.

My problem was actually that I was testing it in Visual Interdev so it wasn't changing the title!

Many Thanks

I will now add that bit of programming to 15 frame pages!
 
Doh!

Been there, done that. Good luck, and sorry I was obtuse in my 1st post above.
 
Hello all,

Simply put as a recap, it is all based on
Code:
     parent.document.title = &quot;new title&quot;
or
     top.document.title = &quot;new title&quot;
regards - tsuji
 
Yes, using &quot;top&quot; is much more common for frames pages. Thanks for adding that tsuji. It goes right to the &quot;top&quot; of the frames hierarchy and to the outermost container: the frames page.

Both parent and top are actually implied references to window properties (i.e. window.parent and window.top) in case this wasn't clear. So when locating information on them in DHTML object model or W3C DOM documentation look for them as properties of the window object.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top