473,699 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

master page affect firefox get the ID of parent's iframe

14 New Member
My project has 3 files,
File1 has included master page.
file1 consists of iframe1 that load file2.
File2 consists of iframe2 that load file3.
Javascript used on each file to resize the iframe height based on the each iframe's content height.
It is work well on IE, but the error "has no properties" occured with firefox on code as below. Where both code is to get the id of iframe on file1.
parent.document .getElementById ("file1iFrame") .height
self.parent.par ent.document.ge tElementById('f ile1iFrame')
I create another file0 which without master page, it work well on firefox to resize iframe.
So anyone has any idea of what the code suppose to use to get the ID of iframe on file1?

My original code as below which on file1.
CALL javascript:
Expand|Select|Wrap|Line Numbers
  1. file1iFrame.Attributes.Add("onload", "size_iframe('file1iFrame')")
Expand|Select|Wrap|Line Numbers
  1. function size_iframe(id){
  3.         var newheight;
  5.         if(document.getElementById){
  7.             if(navigator.userAgent.indexOf("MSIE")!=-1){
  8.              newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
  9.              }
  10.               if(navigator.userAgent.indexOf("Firefox")!=-1){
  11.              newheight=document.getElementById(id).contentDocument.body.scrollHeight;
  12.               }
  13.         }
  14.         if(navigator.userAgent.indexOf("MSIE")!=-1){
  15.          document.getElementById(id).style.height= (newheight+10) + "px";
  16.          }
  17.             if(navigator.userAgent.indexOf("Firefox")!=-1){
  18.          document.getElementById(id).height= (newheight+10) + "px";
  19.          }
  20.    }
CODE ON file2:
CALL javascript:
Expand|Select|Wrap|Line Numbers
  1. file1iFrame.Attributes.Add("onload", "size_iframe('file2iFrame')")
Expand|Select|Wrap|Line Numbers
  1. <body onload="autoParentIframe()">
Expand|Select|Wrap|Line Numbers
  1. function autoParentIframe(){ 
  2.     var x = 0;
  3.     var y = this.document.body.scrollHeight;
  4.     while (x < y){
  5.         x+=1;
  6.     }
  7.     ///////////// reset iframe size for Opera //////////////
  8.     if(navigator.userAgent.indexOf("Opera")!=-1){
  9.        parent.document.body.scrollHeight = x;
  10.     }
  11.     /////////////////////IE(5.5+), Opera///////////////////////////////
  12.     if(navigator.userAgent.indexOf("MSIE")!=-1){
  13.     parent.document.getElementById("file1iFrame").style.height = x;
  14.     }
  15.     ///////////////////// Firefox //////////////////////////////
  16.     if(navigator.userAgent.indexOf("Firefox")!=-1){
  17.       parent.document.getElementById("file1iFrame").height = x;
  18.     }
  19. }
CODE ON file3
Expand|Select|Wrap|Line Numbers
  1. <body onload="reloadparent()">
  2. function reloadparent()
  3.         {
  4.             autoResizeObject(self.parent.document.getElementById('file2iFrame'));
  5.             autoResizeObject(self.parent.parent.document.getElementById('file1iFrame'));
  6.         }
  8.         function autoResizeObject(obj)
  9.         {
  10.             var newheight;
  11.             var newwidth;
  12.             if(document.getElementById){
  14.                 if(navigator.userAgent.indexOf("MSIE")!=-1){
  15.                 newheight=obj.contentWindow.document.body.scrollHeight;
  16.                 }
  17.                 if(navigator.userAgent.indexOf("Firefox")!=-1){
  18.                 newheight=obj.contentDocument.body.scrollHeight;
  19.                 }
  20.                            }
  21.             obj.style.height= (newheight+10) + "px";
  22.                    }
Mar 12 '08 #1
1 3534
16,027 Recognized Expert Moderator MVP
So which line does this error occur?

What's the difference client-side between a master page and a non-master page?
Mar 13 '08 #2

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

Similar topics

by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then use that data to populate the controls when the child page is opened again. One of these objects contains an Array, and the page reloads fine using myArray, myArray, etc... But when I try perform some array methods on it (i.e.slice) ... it does...
by: moondaddy | last post by:
I'm building a page in vb.net with several user controls on it. I'm using user controls instead of a frames page since I've seen this recommended many times in this user group. I want just one of the user controls to do a postback but not the rest of the page. Is this possible? it seems like it should be. If it is, please explain how I can do it. Thanks. -- moondaddy@nospam.com
by: PD | last post by:
I have a parent .Net page (http://mywebsite/project.aspx) that has an iframe (http://iframe/iframe.aspx) which are on seperate domains. I need to adjust the scrolling on the parent window due the size of the iframe. It displays a rather lengthy message which causes scrolling on the parent page (not in the iframe) which is what the UI folks want. I need to be able to scroll the parent page from a click in the iframe. After they read this...
by: Edwin | last post by:
I've been Googling & can't find a consistent cross-browser (IE & Firefox) answer to this... I need to pass some data from inside an iframe, to the parent page I've got the parent page PAGE1.HTM which contains <div ID="mydata"></div> : <iframe src="page2.htm"></iframe>
by: n# | last post by:
I have an old existing website with a Header/ Left Hand Menu and a iframe as the main body content, adjacent to the menu. So for every click on the menu item, I used to load a aspx page on the iframe and hence i am not loading the entire menu and header for each request. When I try and port the above model to Master Page 1) The menu ( I thot of having the Menu Web control), Header would be moved to the master page.
by: Rich | last post by:
Hi, I want to use 2 master pages, one for the main part of the site, the other for the admin pages. They are quite similar, with many shared elements. Ideally I would like to have a parent master page, which both of these child master pages are based on, and in turn the final pages are based on one of these child master pages.
by: djlender | last post by:
Hi All! I'm hoping someone can help me with this situation. I am a developer working on a project that has a video voting page. The situation is this: The parent page has an iFrame ( named iFrame1 ) and it is supposed to load in an external .html page that has a flash video in it. The external .html page is supposed to load when a user clicks on a thumbnail image on the parent page. There are 20 external .html pages that a user can load in...
by: ojsimon | last post by:
Hi I am having a problem fixing a bug with my site, which affects both IE and Opera, but does not affect Safari, Firefox or any other browser that i know of. the affected part goes like this. 1) The page widgetprep.html - This page creates the structure of the widget and shows the frame of google <bgcolor="black"> <div class="container2">
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.