SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: Frames question

  1. #1
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Frames question

    I have a site with two frames a top one and a bottom one.
    Is it possible to get the locations and or title of the bottom frame from the top one?
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Assuming the bottom frame-name is "bottom"

    var bFrame = top.frames['bottom'];
    var loc = bFrame.location.href;
    var title = bFrame.document.title;
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  4. #4
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It works, but bFrame.document.title; works only like 25% of the time very weird
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  5. #5
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Probably load-time/synchrony issues. Hard to say.
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  6. #6
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Basically this is what im trying to do
    I have a top frame and a bottom frame, when I click a link on the top frame I want it to have a ?loc=hrefofbottom window. Is that possible to do, considering the bottom frame will change after the site is opened
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  7. #7
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I don't think that made any sense.

    A link is clicked in the top frame, and you want to append ?loc=hrefofbottom --- I get that part. But where is this link opening? a popup? What will you do with loc?
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  8. #8
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I want to have a link
    <a href="add.php?loc=fhrefofbottom&title=titleofbottom">Link</a>

    I could figure out how to do that wiht document.write, however when the bottom page is changed the code location isnt update that way.
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  9. #9
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or if its a form thats ok too
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  10. #10
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sample
    Code:
    <html>
    <head>
    <title>test</title>
    <script type="text/javascript">
    function setValues( f )
    {
    	var frame = top.frames['bottom'];
    	f.elements['href'].value = frame.location.href;
    	f.elements['title'].value = frame.document.title;
    	return true;
    }
    </script>
    </head>
    <body>
    	<form action="add.php" method="get" onsubmit="return setValues( this )">
    		<input type="hidden" name="href" value="" />
    		<input type="hidden" name="title" value="" />
    		<input type="submit" name="Submit" value="Add To Favorites" />
    	</form>
    	<iframe name="bottom" width="500" height="300" src="http://www.google.com"></iframe>
    </body>
    </html>
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  11. #11
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are the man
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813

  12. #12
    Idea Developer
    Join Date
    Sep 2000
    Location
    Bethlehem, PA
    Posts
    521
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks You are the man
    Professional PHP programing / Hosting
    aim: downtoi3iz icq: 74637813


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
  •