"hqi" <hq*@o2.pl> wrote in message news:<be**********@atlantis.news.tpi.pl>...
<TD WIDTH=559 HEIGHT=100%>
<script language="JavaScript">
document.write("<iFRAME WIDTH=559 height=100% SRC='dane.html'></iframe>
");
...
I would like to change size (HEIGHT i height)
ex:
depending for file 'dane.html' but WIDTH=559 and no-sroling table
You could try to calculate the frame contentWindow height when it is
loaded and resize the iframe element or its container accordingly;
since the iframe width is fixed, you wouldn't have issues with the
flow, maybe just set a "good" default height to avoid unwanted visual
effect (load delay).
This should be fine in IE and Mozilla (not Opera which would need to
have the processing code into the child document, and some additional
patching (iframe width setting for repainting purpose IIRC) to have it
work). Anyway, iframes remain poorly supported in many browsers, so
you may prevent some users from having a full experience; moreover
calculating dimensions is done very differently across UAs, which adds
to the complexity - so be sure to provide an acceptable fall-back
solution if the result isn't good enough.
<script type="text/javascript">
function R(n){
return Math.floor(Math.random()*n);
}
function writeSomeText(){
var s="";
for(var ii=0; ii<2000; ii++)
s+=ii + (R(30)<2 ? "<br>" : "")
return s;
}
function getInnerHeight(iframe){
var d=iframe.contentWindow ?
iframe.contentWindow.document :
iframe.contentDocument;
var h=0;
if(d){
if(d.documentElement && d.compatMode &&
d.compatMode=="CSS1Compat")
h=d.documentElement.scrollHeight;
else if(d.body)
h=d.body.scrollHeight;
if(h) h+=getInsets(d);
}
return (h||300)+"px"; //300 is a default value
}
function getInsets(d){
if(d.body.currentStyle)
with (d.body.currentStyle)
return (parseInt(marginTop)||0) +
(parseInt(marginBottom)||0) +
(parseInt(paddingTop)||0) +
(parseInt(paddingBottom)||0);
if(d.defaultView && d.defaultView.getComputedStyle)
with (d.defaultView)
return parseInt(getComputedStyle(d.body,"").
getPropertyValue("margin-top"))+
parseInt(getComputedStyle(d.body,"").
getPropertyValue("margin-bottom"))+
parseInt(getComputedStyle(d.body,"").
getPropertyValue("padding-top"))+
parseInt(getComputedStyle(d.body,"").
getPropertyValue("padding-bottom"));
return 0;
}
</script>
<iframe src="javascript
:top.writeSomeText()"
width="559"
onload="this.style.height=getInnerHeight(this)"></iframe>
<table>
<tr>
<td height="300">
<iframe
height="100%" width="559"
src="javascript
:top.writeSomeText()"
onload="
if(this.parentNode)
this.parentNode.style.height=getInnerHeight(this)" >
</iframe>
</td>
</tr>
</table>