How change the height of the iframe at run time- using script

Following javascript is useful when we wants to change the height of the iframe at run time
<asp:Content ID=”ModuleContent” ContentPlaceHolderID=”ModuleContent” Runat=”Server”> 
 <iframe id=”testFrame” src =”c:\Test.html” scrolling=”no” width=”80%” height =”0″ frameborder=”0″ onload=”resizeFrame(this);”>
 </iframe>  
 <script type=”text/javascript” language=”javascript”>
  function resizeFrame(iframe) {
   {
    iframe.height = document.frames[iframe.id].document.body.scrollHeight + 20;    
   }
  }
    </script>
</asp:Content>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: