Results 1 to 6 of 6

Thread: Changing the Title of a Frameset Document

  1. #1
    Join Date
    Mar 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Changing the Title of a Frameset Document

    As the title states, I want a script that will change the title of the document when one of the frames changes.

    My frameset document has run of the mill code, so that won't be very difficult.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title> Welcome! </title>
    </head>
    
    <FRAMESET border=0 frameSpacing=0 frameBorder=0 cols=220,*>
    	<FRAME name=MENU src="Frameset-Left-Menu.html" noresize>
    
    		<FRAME name=VIEW  src="Frameset-Center-Home.html">
    	</FRAMESET><noframes></noframes>
    </FRAMESET>
    </html>
    In case I did not make it clear enough earlier, what I want the frameset document to do is have the title (in red) change when frameset "VIEW" changes.


    Any help would be greatly appreciated.

    Regards
    -Anon

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Try putting this on your page:
    Code:
    <script type="text/javascript">
    a = document.getElementById('frame_v');
    if(a.name != "VIEW"){
    document.title="The view has changed!";
    } else {
    document.title=document.title;
    }
    </script>
    Then switch:
    Code:
    		<FRAME name=VIEW  src="Frameset-Center-Home.html">
    To:
    Code:
    		<FRAME name=VIEW  src="Frameset-Center-Home.html" id="frame_v">
    Jeremy | jfein.net

  3. The Following User Says Thank You to Nile For This Useful Post:

    Anon (03-25-2008)

  4. #3
    Join Date
    Mar 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help, but the code didn't work. But then again I may havr placed it in the wrong section.

    I tried placing it in the head of the document,
    Code:
    <head>
    <script type="text/javascript">
    a = document.getElementById('frame_v');
    if(a.name != "VIEW"){
    document.title="The view has changed!";
    } else {
    document.title=document.title;
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title> Welcome! </title>
    </head>
    And after the head,

    Code:
    </head>
    <script type="text/javascript">
    a = document.getElementById('frame_v');
    if(a.name != "VIEW"){
    document.title="The view has changed!";
    } else {
    document.title=document.title;
    }
    </script>
    But since this is a frameset document, there is no body tag, where I would normally place a code if none of these worked. Please tell me if I placed the code in the wrong place.

    Oh, I did remember to place the other section of the code.

    Thanks for your help!

    -Anon

  5. #4
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, can you please tell me what you are gonna do with the name changes?
    Like are you gonna have JavaScript change the names? If you have javaScript change the names you can put it in that in the function to change the document title. Example:
    Code:
    function change_name(){
    document.getElementById('id').name="Hey";
    document.title="The id.name has been changed *gasp*!";
    }
    Jeremy | jfein.net

  6. #5
    Join Date
    Mar 2008
    Posts
    9
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    What I want to happen is have the title of the Frameset document be the same as the title of "VIEW".

    I thought that maybe it could be:
    Code:
    <script type="text/javascript">
    a = document.getElementById('frame_v');
    if(a.name != "VIEW"){
    document.title=frame_v.title;
    } else {
    document.title=document.title;
    }
    </script>
    But I don't quite know if that would work.

    Thanks for the help so far.

    -Anon

  7. #6
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    I don't think that you can change the title of the framset. Your code also won't work because your referring to the id being a name...
    Jeremy | jfein.net

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •