By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,620 Members | 982 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,620 IT Pros & Developers. It's quick & easy.

resizing nested iframes - help!!!

helpmepls
P: 5
i have a site where I have an iframe mainFrame which loads page content from the main menu (top horizontal menu).

within this mainFrame is a second menu to left specific to the loaded page, and another iframe (ie. suppFrame) which loads content from this left menu. The reason for the second iframe is some of the pages have different left menus.

this works fine, apart from resizing of the page. I do not wish to use scroll bars. Say if I click on the Support page in the main menu, the initial page loads and resizes fine. But if I wish to click one of the left menu options to load in the suppFrame this stays the same size as the intially loaded page and does not stretch/shrink to suit the new content.

Does anyone know how to efficiently resize nested iframes? or have a better solution?

i tried creating multiple pages for the main menu with includes for header, left menu etc. but you get that horrible flash when the page reloads, the iframe seems more seamless to the user.

thanks!
Mar 13 '08 #1
Share this Question
Share on Google+
1 Reply


helpmepls
P: 5
Just thought I'd share what I ended up doing for this one (in ASP.NET VB):

I now have a master page with the header built in including a logo, image and the main menu. The master page then has two contentplaceholders, one on left for the submenu and one to the right for the body page. The master also has the resize iframe code from Dynamic Drive: http://www.dynamicdrive.com/dynamici...iframessi2.htm

I have a Default.aspx based on this master. The left contentplaceholder has content as an iframe named menuFrame and the right contentplaceholder has content as an iframe named bodyFrame.

I found a cool javascript that loads content into two iframes at once. I included it in the master page. Now I only need that default.aspx page to control the site, and the htm pages to load in the iframe and it loads smoothly.

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript"> 
  2. function loadTwo(iframe1URL, iframe2URL) 
  3. parent.menuFrame.location.href=iframe1URL 
  4. parent.bodyFrame.location.href=iframe2URL 
  5. </script> 
and the link to open the page will be
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:loadTwo('[content for first iframe],'[content for second iframe]')"> link </a>
here's the site I got that from:
http://www.samisite.com/test-csb2nf/id82.htm


Hope this is useful for someone else as I searched high and low to find a solution!
Mar 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.