Search results for 'iframe auto resize'. 1 post(s) found.
- 2008/05/03 IFRAME Auto Resize in IE, FireFox by Javascript (13)
2008/05/03 08:39
IFRAME Auto Resize in IE, FireFox by Javascript
2008/05/03 08:39 in HTML, Javascript

Here's the simple iframe auto-resize example working on IE, and FireFox.
<iframe id='ifrm'
frameborder=0
width=100%
height=450
scrolling=no
src='http://kurapa.com'
></iframe>
<script language='javascript'>
function getDocHeight(doc)
{
var docHt = 0, sh, oh;
if (doc.height)
{
docHt = doc.height;
}
else if (doc.body)
{
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}
frameborder=0
width=100%
height=450
scrolling=no
src='http://kurapa.com'
></iframe>
<script language='javascript'>
function getDocHeight(doc)
{
var docHt = 0, sh, oh;
if (doc.height)
{
docHt = doc.height;
}
else if (doc.body)
{
if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
if (sh && oh) docHt = Math.max(sh, oh);
}
return docHt;
}
var iframeEl = window.document.getElementById? window.document.getElementById('ifrm'): document.all? document.all['ifrm']: null;
if (docHt != iframeEl.style.height) iframeEl.style.height = docHt + 'px';
}
else
{ // FireFox
var docHt = window.document.getElementById('ifrm').contentDocument.height;
window.document.getElementById('ifrm').style.height = docHt + 'px';
}
}
}
else
{ // FireFox
var docHt = window.document.getElementById('ifrm').contentDocument.height;
window.document.getElementById('ifrm').style.height = docHt + 'px';
}
}
function getRetry()
{
getReSize();
setTimeout('getRetry()',500);
}
getRetry();
</script>
{
getReSize();
setTimeout('getRetry()',500);
}
getRetry();
</script>
Another posts included in "HTML, Javascript"
| Clipboard copy function working (0) | 2008/10/17 |
| How to find the ip address of a client machine from a web application? (0) | 2009/03/21 |
| Simple RSS Reader based on javascript (0) | 2009/07/01 |
| How to include Javascript from anonther ? (0) | 2008/01/25 |
| Javascript based Browser Sniffing (0) | 2008/01/25 |
| Javascript based Regular Expression Tester (0) | 2008/01/15 |
| Two useful string functions - substr & substring (0) | 2008/01/15 |
| Is there URLEncode function in Javascript ? (0) | 2007/10/11 |
Prev

Rss Feed