在页面中置入一iframe,如果定位两个滚动条?
下面代码号称可以生效果,但试了不行:滚动条始终在最下端:
window.onload=function (){
document.documentElement.scrollTop=parseInt(document.body.offsetHeight)-parseInt(document.documentElement.offsetHeight)+100;
}
/*上面的加100是因为取offsetHeight的值不是很准,所以自己改到准为止*/滚动条始终在最上端:
window.onload=function(){
document.documentElement.scrollTop=0;
}

解决方案 »

  1.   

    定义Iframe的宽度和高度,当Iframe内嵌页面的内容超过了设置的高,宽时,Iframe就会自动添加滚动条
      

  2.   

    我是要通过定位两个滚动条,来控制显示iframe所载入的页面,在父页面中显示的部分。
      

  3.   

    window.onload=function (){
    document.documentElement.scrollTop=parseInt(document.body.offsetHeight)-parseInt(document.documentElement.offsetHeight)+100;
    }
    /*上面的加100是因为取offsetHeight的值不是很准,所以自己改到准为止*/滚动条始终在最上端:
    window.onload=function(){
    document.documentElement.scrollTop=0;
    }----------------
    把上面的document.documentElement都改为document.frames["frameName"]
    防止报错最好先判断一下if(document.frames["frameName"])...
    试试
      

  4.   

    document.getElementById('iframe').contentWindow.document.body.scrollTop;document.getElementById('iframe').contentWindow.document.body.scrollHeight;可考虑设置iframe的高宽<iframe id="info" style="font-size:12px;"></iframe>
      

  5.   

    document.getElementById('iframe').contentWindow.document.body.scrollTop;document.getElementById('iframe').contentWindow.document.body.scrollHeight;