SOURCE

console 命令行工具 X clear

                    
>
console
function getHeight(node) {
  node.setAttribute('style', 'visibility: hidden;display: block');
  var _h = getComputedStyle(node, false)['height'];
  node.setAttribute('style', 'visibility: unset;display: none');  
  return parseInt(_h);
}
var oButton = document.getElementById('getHeight');
oButton.onclick = function () {
  var oDiv = document.getElementById('box');
  var oText = document.getElementById('myText');
  oText.innerText = getHeight(oDiv);
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <title>Document</title>
</head>
<body>
  <div id="box" class="box">
    我是display: none的高度
  </div>
  <button id="getHeight">获取高度</button>
  <h1>display为none那个高度为: <span id="myText"></span></h1>
</body>
</html>
.box {
  display: none;
}