Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Resizing IFrame
Message
From
15/12/2011 04:33:41
 
 
To
14/12/2011 15:55:53
General information
Forum:
Javascript
Category:
IFrame
Title:
Miscellaneous
Thread ID:
01531057
Message ID:
01531091
Views:
73
Hi Michel,

My $.03... I would:
1- declare c and loIFrame as var otherwise JavaScript adds them as properties to the Global Object,
2- make sure iframe exist, just in case ...,
3- use a frameWork such as jQuery or Prototype (my favorite) to be sure code is cross-browser...

Sample code with prototype.js v 1.7
function ResizeIFrame(tcIFrame)
{
  var loIFrame = $(tcIFrame);
  if (loIFrame) loIFrame.height = loIFrame.getHeight()+17+'px';
}
thn

>This is a much simpler version:
>
>
>function ResizeIFrame(tcIFrame)
>{
>   loIFrame=document.getElementById(tcIFrame)
>   c=(loIFrame.contentWindow || loIFrame.contentDocument)
>   loIFrame.height=parseFloat(c.document.body.scrollHeight || c.scrollHeight)+17
>}
>
>
>And, it works.
>
>I am just trying to figure out a better way to lay out that function in regards to the last two lines. If someone has an idea on how to better formulate that that it would be more readable, that would be appreciated.
Thierry Nivelet
FoxinCloud
Give your VFP application a second life, web-based, in YOUR cloud
http://foxincloud.com/
Never explain, never complain (Queen Elizabeth II)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform