PDA

View Full Version : large white space after auto resized iframe



hanpedro
07-18-2012, 02:12 PM
I used code at http://www.codingforums.com/showpost.php?p=1129466&postcount=46 for auto resizing iframe.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>test-paper</title>
<script language="javascript" type="text/javascript">
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
obj.style.width = obj.contentWindow.document.body.scrollWidth + 'px';
}
</script>
</head>

<body>
<iframe id="content" name="content" frameborder="0" scrolling="no" width="100%" src="./test-paper.php" onload='javascript:resizeIframe(this);'></iframe>
<body >

</body>
</hrml>

This code for "2. BODY" at the attached pictiure. And it works, but there are two problems.

1. At firefox there is a large white space after auto resized iframe - that is "4. White Space" at the attached picture.

2. At IE there is 10 times larger white space after auto resized iframe - that is "4. White Space" at the attached picture.

Please let me know how to remove these white space.

Thanks in advance.