Wrox Home  
Search P2P Archive for: Go

  Return to Index  

html_code_clinic thread: frame question


Message #1 by "Tim Zhang" <tzhang@h...> on Thu, 22 Mar 2001 19:29:01
Sorry, I should never have sent this without comments. The
"FrameContactDisplay"  is the name that I gave the frameset so that I could
reference it in Code. Yes it will work in IE

Here is two pages that you can use to show how you can resize frames by
either
1. Calling code that is on the frameset page or
2. Calling code from the frame page that affects the parents frameset

******* Frameset page ***********
<html>
<script>
	function	SetContentFrameToHalf()
	{
		document.all.MyFrames.rows = "*,50%"
	}
</script>

<frameset rows="100,*" name="MyFrames">
   <frame name="bannerFrame">
   <frame name="contentFrame" src="Stub.htm">
</frameset>
</html>
*************** Stub.htm *************
<html>
<head>
</head>
<body>
<button onClick="ResizeMe()">Press Me to resize with native code</button>
<button onClick="ResizeMe2()">Press Me to resize by calling code from the
parent</button>
</body>
</html>
<script>
	function ResizeMe()
	{
	parent.frames.MyFrames.rows = "*,100"
	}
	function ResizeMe2()
	{
	parent.frames.SetContentFrameToHalf()
	}
</script>
***************************** End of response ********************
-----Original Message-----
From: Tim Zhang [mailto:tzhang@h...]
Sent: Thursday, March 22, 2001 5:11 PM
To: HTML Code Clinic
Subject: [html_code_clinic] RE: frame question


Thank you for your response.

could you please explain a little bit on "FrameContactDisplay"?  Does that 
work in IE5?

I wondered if you can take a look the following code and see how to make 
it work.

Thank you very much!

Here is the code I have:
Main page:
<html>
<head>
<title>Untitled</title>
</head>
<frameset rows="100,*">
   <frame src="frame1.asp" name="bannerFrame">
   <frame src="frame2.asp" name="contentFrame">
</frameset>
</html>

frame1.asp:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
function removeBanner(){
  document.all.FrameContactDisplay.rows = "0,100%";
}
</script>
</head>
<body>
<a onclick="removeBanner()">Remove this banner frame.</a>
</body>
</html>

frame2.asp:
<html>
<head>
<title>Untitled</title>
</head>
<body>
this is content frame.
</body>
</html>







> You can dynamically resize the frames to do this
>  Heres a function I use to set a left hand frame to either 30% or 0
> 
> 	function DisplaySidebar(fTrueFalse)
> 	{
> 	if (fTrueFalse)
> 		{
> 		document.all.FrameContactDisplay.cols = "*,30%"
> 	} else {
> 		document.all.FrameContactDisplay.cols = "100%,0"
> 		}
> 	}
> 
> 
> -----Original Message-----
> From: Tim Zhang [mailto:tzhang@h...]
> Sent: Thursday, March 22, 2001 2:29 PM
> To: HTML Code Clinic
> Subject: [html_code_clinic] frame question
> 
> 
> Hi:
> 
> I have a page which has two frames.  
> 
> I'd like to do this:  when the "remove" button in the top frame is 
> clicked, window will close the top frame and use the whole page to 
display 
> the content curently in the lower frame.
> 
> What is the simple way to do it?
> 
> Thanks!
> 
> 
> 

  Return to Index