Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Everthorpe, nr Hull, UK
    Posts
    106
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I have a "Put In Frame Script" here but it needs a tweak

    Hi there

    this script breaks a page out of a frame, i want to reverse this so that if the page is not in a frame it will go and fetch the correct frame.

    this is the bustframe script:

    <script language="JavaScript" type="text/JavaScript">
    <!--
    function BustFrames() {
    if (self.parent.frames.length!=0)
    {
    self.parent.location.replace(document.location.href);
    }
    }
    //-->
    </script>

    I figure that if i swap a few bits round like so:

    <script language="JavaScript" type="text/JavaScript">
    <!--
    function AW_BustFrames() {
    if (self.parent.frames.length!=1 )
    {
    self.parent.location.replace(document.location.href); ;
    }
    }
    //-->
    </script>

    By changing the 0 to 1 i hoping this will mean if it is not in a fram then do the second bit in red but i need this bit to go to a url that i type in.

    So can anybody help me with this one.

    cheers dean
    Cheers

    Dean

    In the beginning god said "let there be light." and from out of the darkness a pen pusher was heard to say "not to much. that's expensive that is!"

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is one that I got from somebody in this forum. The first part checks to see if the page is not in a frame. If it is not then it redirects to the frameset with the location attached to the URL.:
    <html>
    <head>
    <title>Force Frames Test</title>
    <script language="JavaScript">
    if (self == top)
    {
    var url = self.location;
    self.location = "http://www.mysite.com/frset.html?" + url;
    }
    </script>
    </head>
    <body>

    </body>
    </html>

    In the frameset you then have code to check if there is a value attached to the URL. If there is it then loads that page into the frame.

    <html>
    <head>
    <title>Frame Print Demo</title>
    <script language="JavaScript">
    function frame_saver()
    {
    if (self.location.search)
    {
    parent.frameb.location = location.search.substring(1,location.search.length);
    }
    }
    window.onload = frame_saver;
    </script>
    </head>
    <frameset rows="25%,*" border="1">
    <frame src="looka.html" name="framea">
    <frame src="lookb.html" name="frameb">
    </frameset>

    "frameb" has a defualt page in case there is not a value attached to the URL.


  •  

    Posting Permissions

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