[Javascript] Dynamically resizing an iframe

Shawn Berg bergshawn at hotmail.com
Thu Nov 29 09:40:53 CST 2001


The type of file does not matter.. ASP files output the same HTML as .htm
files, the only difference being that you cannot do any server side
scripting in an HTML file. I'd read the article again and check your code to
make sure it matches up properly. The problem definitely does not have to do
with the fact that it is an ASP file.

Shawn

----- Original Message -----
From: "Herzner, Daniel" <DHerzner at andorcap.com>
To: <Javascript at LaTech.edu>
Sent: Thursday, November 29, 2001 10:38 AM
Subject: [Javascript] Dynamically resizing an iframe


> Hi All, I'm trying to include an iframe on a web page whose source is an
> .asp file. I want the frame to be sized dynamically depending upon the
size
> of its src. The src file will always be a fixed width but the height can
> vary quite a bit. I found a technet article that made doing this sound
> pretty easy. The article only talks about doing this with an htm file as
the
> src. Am I having trouble doing this because I'm using an .asp file? The
> article includes some javascript:
>
> function reSize()
>   {
>   try{
>   var oBody = ifrm.document.body;
>   var oFrame = document.all("ifrm");
>
>   oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight -
> oBody.clientHeight);
>   oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth -
> oBody.clientWidth);
>   }
>   //An error is raised if the IFrame domain != its container's domain
>   catch(e)
>   {
>   window.status = 'Error: ' + e.number + '; ' + e.description;
>   }
>   }
>
> and then the html:
>
> <BODY onload=reSize()>
>   <iframe onresize=reSize() id=ifrm src=YOUR_PAGE_HERE></iframe>
> </BODY>
>
> So, I'm doing all of this but it's not making a difference to what I'm
> trying to achieve. Can someone out there please give me a hand with this?
> I've done my homework but still can't see how to pull this off. Thanx in
> advance everyone...
>
> Dan Herzner
> phn: 203-588-2294
> fax: 203-588-2460
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list