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;
              }
             
          }   
          
    } 
  • 相关阅读:
    说下vue工程中代理配置proxy
    说一下登陆页面的实现逻辑
    $router和router区别
    iframe中涉及父子页面跨域问题
    浅析闭包
    用户注册之短信验证
    vue.js(三)
    vue.js(二)
    vue.js(一)
    批量更改会员权限
  • 原文地址:https://www.cnblogs.com/jinzhiming/p/5132394.html
Copyright © 2011-2022 走看看