Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Resizing IFrame
Message
De
15/12/2011 04:33:41
 
 
À
14/12/2011 15:55:53
Information générale
Forum:
Javascript
Catégorie:
IFrame
Titre:
Divers
Thread ID:
01531057
Message ID:
01531091
Vues:
72
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform