zoukankan      html  css  js  c++  java
  • 每天一个JavaScript实例-获取元素当前高度

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>每天一个JavaScript实例-获取元素当前高度</title>
    <style>
    	#date{90%;height:25%;padding:10px;background: red;}
    </style>
    <script>
    window.onload = function(){
    	var height = getHeight();
    	console.log(height);
    }
    function getHeight(){
    	var height = 0;
    	var div = document.getElementById("date").getBoundingClientRect();
    	if(div.height){
    		height = div.height;
    	}else{
    		height = div.bottom - div.top;
    	}
    	return height;
    }
    </script>
    </head>
    
    <body>
    <div style="1000px;height:800px;">
    <div id = "date">
    </div>
    </div>
    </body>
    </html>
    

  • 相关阅读:
    填充与复制
    张量排序
    数据统计
    合并与分割
    前向传播(张量)- 实战
    数学运算
    Broadcasting
    TensorFlow2-维度变换
    集合3
    集合2
  • 原文地址:https://www.cnblogs.com/yxysuanfa/p/7170900.html
Copyright © 2011-2022 走看看