0
我想获得整个屏幕高度,直到滚动发生(内容的总高度),这里是我尝试的代码,但我得到的值为0,对于如我的猜测是,整个屏幕的高度将更加然后1400px 如何得到确切高度如何从iframe或外部div获取滚动高度
<div id="sample">
<iframe src="https://en.wikipedia.org/wiki/Main_Page" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0x;left:0px;right:0px;bottom:0px" height="100%" width="100%" allowfullscreen id="frame" onload="myFunction()">
</iframe>
<div style="display:block; clear:both;"></div>
</div>
<script>
function myFunction() {
var elmnt = document.getElementById("sample");
var y = elmnt.scrollHeight;
var x = elmnt.scrollWidth;
var sample = "Height: " + y + "px<br>Width: " + x + "px";
alert(sample);
}
</script>