< >

iframe-scrollen.php


Quell Code


<!doctype html>
<html lang="de">
<head>
<title></title>
<style>
#test{
width:80%;
margin:0 auto;
height:200px;
overflow:auto;
}
</style>
</head>
<body>





<iframe id="test" src="../../homepage-neu/"></iframe>
<script>
 
    var box=document.getElementById('test');

    box.scrollTop = box.scrollHeight;
  console.log(box.scrollTop+'='+box.scrollHeight+'='+box.clientHeight)
 
</script>
<script>
  var framefenster = document.getElementById("test");
  var auto_resize_timer = window.setInterval("autoresize_frames()", 400);
  function autoresize_frames() {
    for (var i = 0; i < framefenster.length; ++i) {
        if(framefenster[i].contentWindow.document.body){
          var framefenster_size = framefenster[i].contentWindow.document.body.offsetHeight;
          if(document.all && !window.opera) {
            framefenster_size = framefenster[i].contentWindow.document.body.scrollHeight;
          }
          framefenster[i].style.height = framefenster_size + 'px';
        }
    }
  }
</script>
</body>
</html>