Hi I want to set the css height of an iframe based on how big the screens is but I don’t know how to do this.
CSS:
#iframeplate{
width:100%;
height:200px;
}
HTML:
<body onload="setGround()">
<iframe id="iframeplate" class="idIframe" frameborder=0 border=0 width="100%" scrolling-y="no" src="#">
</iframe>
</body>
JS:
<script type="text/javascript">
function setGround() {
var groundElement = document.getElementById('iframeplate');
groundElement.style.height = getWindowHeight() + 'px';
}
}
</script>
Can anyone see why this would not work? Or any ideas on a better way to do it?
The error is the method of
getWindowHeight,there isn’t output.Try this: