Jump to content

how to find height of page in iframe


jitesh

Recommended Posts

Hi,

        Use this Code....

 

<script language="javascript">

function autoIframe(frameId)

{

  try

  {

  frame = document.getElementById(frameId);

  innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;

  objToResize = (frame.style) ? frame.style : frame;

  objToResize.height = innerDoc.body.scrollHeight + 10;

  }

  catch(err)

  {

  window.status = err.message;

  }

}

<script>

 

<iframe id="myframe" name="myframe" onload="if (window.parent && window.parent.autoIframe) {window.parent.autoIframe('myframe');}" frameborder=1 marginwidth=0 scrolling=auto src="http://phpfreaks.com"></iframe>

 

Add this javascript to your page.

Add this onload event to your iframe to get the height and width of the page dynamically.

 

Thanx

Prabhu SM

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.