Framesets and <TITLE>

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Zomis
Forum Newbie
Posts: 7
Joined: Tue Mar 11, 2003 9:32 am
Location: Sweden
Contact:

Framesets and <TITLE>

Post by Zomis »

When you use a frameset, and you want browsers to display the title of one of the frames, how to do?

index.php:

Code: Select all

<HEAD>
<TITLE>Zomis Productions</TITLE>
</HEAD>
<HTML>
  <FRAMESET rows="80, *, 50" border="0">
    <FRAME src="frame_top.php" noresize scrolling="no">
    <FRAME src="home.php" noresize scrolling="yes" name="mainFrame">
    <FRAME src="frame_bottom.html" noresize scrolling="no">
  </FRAMESET>
</HTML>
home.php:

Code: Select all

<HEAD>
<TITLE>Zomis Productions - Home</TITLE>
</HEAD>
This is Zomis Productions' home page!<BR>
Now, when I go to index.php it says "Zomis Productions" in the title, not "Zomis Productions - Home"!
If I remove the title in the index.php the title is the address instead,
so how should I do to display "Zomis Productions - Home" in the title (or whatever the title of the frame "mainFrame" is).

hope you understand me...
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

First, try to remove the <TITLE>...</TITLE> inside index.php. That may work, if not, just change the value inside the <TITLE> tags in index.php.
Image Image
Zomis
Forum Newbie
Posts: 7
Joined: Tue Mar 11, 2003 9:32 am
Location: Sweden
Contact:

Post by Zomis »

phice wrote:First, try to remove the <TITLE>...</TITLE> inside index.php. That may work, if not, just change the value inside the <TITLE> tags in index.php.
If I remove the tags in index.php, the adress shows up as the title instead (i.e. "http://zomis.xplorer.nu").
And If I change the value inside the tags, I will only have one constant value, but I want the title of the frame as the title.
And the title of the frame changes, depending on which page I am at.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

If called from the frame-parent

Code: Select all

<script language="JavaScript" type="text/javascript">
document.title=document.mainFrame.document.title;
</script>
If called from within a frame

Code: Select all

<script language="JavaScript" type="text/javascript">
parent.document.title=document.title;
</script>
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Very nice, i've never known how to do that before. 8)
Post Reply