SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member Facecat's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Automatic Frame Popups

    Is there a script that on loading a certain page will check to see if its in a frameset, and if it isn't in said frameset to make it be in that frameset.

    For example, I have a popup that has a navigation frame at the top and a content frame at hte bottom. I want to be able to have links link to it (the popup, from wherever) that can open any of the pages inside this frameset, without making a separate frameset for each page of content. If I could get it to open the content page, and the content page open itself into the frameset, or even built itself its own frameset, that would be neato keen.

    Anyway any help I would appreciate.

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you mean something like this:
    <html>
    <head>
    <title>Create Frame</title>
    <script language="JavaScript">
    function CreFrPg(linkid)
    {
    NewWin=window.open("","frwin" )
    NewWin.document.write("<html>" )
    NewWin.document.write("<head>" )
    NewWin.document.write("<title>Frame Page</title>" )
    NewWin.document.write("</head>" )
    NewWin.document.write("<frameset rows='8%,*' border='1'>" )
    NewWin.document.write("<frame src="crefrmenu2.html" name='menu'>" )
    NewWin.document.write("<frame src="http://"+linkid+"" name='content'>" )
    NewWin.document.write("</frameset>" )
    NewWin.document.close()
    }
    </script>
    <style>
    A{text-decoration:none}
    A:link {color:slateblue}
    A:visited {color[img]images/smilies/redface.gif[/img]rchid}
    </style>
    </head>
    <body bgcolor="lightgreen">
    <br><br><br>
    <center>
    <a href="#" onClick="CreFrPg('www.brainjar.com')">Brain Jar</a>
    <br>
    <a href="#" onClick="CreFrPg('www.htmlgoodies.com')">HTML Goodies</a>
    </center>
    </body>
    </html>

  3. #3
    SitePoint Member Facecat's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah that looks like its the right idea, except I can't get it to work right. I fiddled with it and could get the topframe to work but not the bottom. Also it causes the linking document (I mean the browser that contains this html file that opens the framed thing) to go to a blank page once the popup opens.

  4. #4
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It did work correctly when I tested it. Can you give me a link to the code you modified?

  5. #5
    SitePoint Member Facecat's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I got it to work now, here: http://www.menupalace.ca/test/_CODE/framelauncher2.html

    Thanks for your help, by the way. Now I have a new question. Is there a way of modding this script to make it so that whenver you view a certain page, it forces the browser to view it in a certain frameset? Can either be a frameset.html file or in the script itself, whatever works. This would actually be really helpful.

  6. #6
    SitePoint Zealot simplyunique's Avatar
    Join Date
    Jun 2003
    Location
    Montreal
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simplest one available.
    Code:
     <!-- 
    if (parent.frames.length==0)
    window.location.replace("frameset.htm" )
    //-->
    that is.. if frameset.htm has reference in it to the file. if it doesent, then theres another one..
    Fonkuscious say: Sink a foot in into my code and stub your toe


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
  •