SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Possible to do this with JS???

    I was wondering if it is possible to do this.

    I want to create a frameset where the title of the frameset changes according to the title of the 'content frame'.

    ie get the frameset title to = the title of the 'content frame'. Can I swing it around somehow so that the script is just in the frameset? - That way I just have one instance if the script (in the frameset that doesn't change).

    As an educated guess from someone totally uneducated in Javascript, I would have thought that inserting this within the frameset may be along the right lines:

    <Title>
    <script>
    contentframe.document.title
    </script>
    </Title>


    Please correct me where I'm wrong!!




    <Edited by ChilliBoy on 12-10-2000 at 03:16 PM>

  2. #2
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    In your Frameset page put:

    Code:
    <script language="Javascript1.2">
    function titler(newtitle) {
    if (document.all)
      document.title=newtitle;
    }
    
    </script>
    In your child documents put:
    Code:
    <body onload="parent.titler('yourtitlehere');">
    Wayne Luke
    ------------


  3. #3
    SitePoint Evangelist
    Join Date
    Oct 2000
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help, but I'm afraid it doesn't solve my problem - Although I think its close.

    I'll explain why: I'm using anaconda foundation products to make a search engine. If you click on any of the search results you can get them to open in your frameset, with a top frame contaning a back to search button (done via CGI). The problem is that if any of the pages are saved it is the title of the frameset that appears in the Fav's not that of the 'content frame'. As I obviously can't put any code in the content frame it needs to be in either the Frameset or the top frame.

    I tried this in the frameset but it didn't work:
    <script language="Javascript1.2">

    if (document.mainFrame){
    document.title=mainFrame.document.title;
    }

    </script>

    I presume I need something along the lines of when mainFrame has loaded alter document.title=mainFrame.document.title

    However my JS is so poor I haven't got a clue - any suggestions?

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 1999
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think - correct me if I'm wrong - the browser doesn't allow you to ask for something like document.title on a webpage that is on another server (for privacy reasons). That would make it impossible to do what you want.


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
  •