FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Closing A Frame? How Do I Do It? (Please Close)

 


mistuh griddlez
Ok. I Need Help On Figuring Out How To Close A Frame. Basically I Need It Like Google Where IT Say Remove Frame And It Opens The Bottom Frame Except I Don't Want To Have To Make A File For Each Frame Set. (Which I Don't Think Google Has A File For Each And Every Search) Well Anyway Basically I Have A Code:

Code:

<?php
$frame=$_GET["body"];
?>

<html><head></head>
<frameset rows=90,* frameborder=0 framespacing=0>
<frame src=head.php noresize scrolling=no name="top">
<frame src=<? echo $frame; ?> name="bottom">
</frameset>
</html>

I Want To Close This (<frame src=head.php noresize scrolling=no name="top"> ) Frame. And Make This (<frame src=<? echo $frame; ?> name="bottom">) Frame Take Up The Whole Page.


How Would I Do That?


Last edited by mistuh griddlez on Wed Jul 26, 2006 3:58 am; edited 1 time in total
UApilot
You would have utilize a client-side script such as JavaScript or VBScript. I'm not too familiar with either but can look into it. Conceptually, I know you'd need a client-side script because a server-side script, such as PHP, will already have executed by the time it reaches the user and won't ever have a chance of executing again.
The way the JavaScript or VBScript would work is that when you click on the link, the link would reference a javascript function that would make the frame you wanted to get rid of hidden. Therefore, it would be easier to work over the contents of one page instead several frames. I recommend, instead, creating a table with the left <td> having a width of 90. The link, I assume would be located in the disappering table cell and would resemble this:
Code:

<a href="top.closeCell()">Remove Frame</a>

The above example uses JavaScript; it is the ideal choice because it does a better job of treating the various parts of a web page as objects and items such as src, width, height, and name as its properties. (Again I am not certain of any of this; the syntax of anything I tell you will definately have to be checked).
Then the function closeCell() can be located anywhere within the page you're using within <script tags>, as so:
Code:

<script type="text/javascript">
void closeCell() //This is definately wrong; its more like: function closeCell()
{
   td.closable.width = 0; //purely conceptual
}

</script>

The "closable" is just simply a way to distinguish the <td> you want to close from any other <td>'s on the web page. In order to distinguish it, you would have to set its "class" attribute to "closable" or whatever you had there, as so:
Code:

<td class="closable" width="90"></td>

I'll look some more into this unless someone else more knowledgeable comes along but these are the basics to what you have to do. In summary, use a table instead of frames, and use a call to a javascript function to set the width property of the left-most cell to zero.
mistuh griddlez
But I Have To Use Frames To Have The Other Website (On A Different Server) At The Bottom. Don't I? Or Would There be A Way To Do It With IFRAMES? I'll Go Experiment.
mistuh griddlez
Nevermind. I Figured It A Much Easier Way That Doesn't Even Involve Opening Or Closing Stuff. Here It Is:

Okay What I Did Was I Used An Iframe Instead Of A Frame And Used Tables Like You Said. And Instead Of Using The Link <a href="top.closeCell()">Remove Frame</a> I Used <a href=<? echo $frame; ?>Remove Frame</a> And So It Just Opens The Page That's On The Bottom Or In The Part After body= In The Url

Ex. http://www.mistuhgriddlez.frih.net/experiment/play.php?body=http://www.mistuhgriddlez.frih.net

And So It Works Perfectly And If It Wasn't For Your Help I Wouldn't Of Figured It Out. Thanks.

please -close-
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.