zoukankan      html  css  js  c++  java
  • js获取页面高度赋值给div

    <script type="text/javascript">
    window.onload=function(){
        map_width=document.body.clientWidth;//获取body宽度
        map_height=document.documentElement.clientHeight;//获取页面可见高度
        //alert(map_width);
        //alert(map_height);
        //下面两行最后的"px"必须加上,折腾了半天老是不显示添加的style,最后就是错在这了
        document.getElementByIdx_x_x("maps").style.width=map_width+"px";
        document.getElementByIdx_x_x("maps").style.height=map_height+"px";
        
    }
    </script> 
    function iframeHeight(iframeId,change) { 
        
          var ifm= document.getElementById(iframeId);  
    
          ifm.name=iframeId;
          
          var clientHeight=document.documentElement.clientHeight;
          
          clientHeight=clientHeight-change;
          
          var subWeb = document.frames ? document.frames[iframeId].document : ifm.contentDocument;   
    
          if(ifm != null && subWeb != null) {
            
              var scrollHeight=subWeb.body.scrollHeight;
    
              if(scrollHeight>clientHeight){
                  
                  ifm.height = clientHeight;
              }else{
                
                  ifm.height = scrollHeight;
              }
             
          }   
          
    } 
  • 相关阅读:
    tensorflow实践学习一
    计算CPU的MIPS
    计算机原理一
    SecureCRT连接虚拟机失败及虚拟机ping不通外网
    03.os
    02.random
    01.time
    01.面试过程中其他问题
    06.秒杀系统架构
    05.项目并发分析
  • 原文地址:https://www.cnblogs.com/jinzhiming/p/5132394.html
Copyright © 2011-2022 走看看