473,545 Members | 2,045 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 3523
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...
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...
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...
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...
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...
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...
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...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
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...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
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...
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...
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: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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...

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.