<! Doctype html> <html> <fead> <meta http-equiv = "content-type" content = "text/html; charset = utf-8"/> <title> 每天一个 javascript 实例-获取元素当前高度 <///style> #date {width: 90%; altura: 25%; almo Window.Onload = function () {var Hight = getheight (); console.log (altura); } función getheight () {var altura = 0; var div = document.getElementById ("fecha"). getBoundingClientRect (); if (div.height) {altura = div.height; } else {altura = div.bottom - div.top; } Altura de retorno; } </script> </head> <body> <div> <div id = "date"> </div> </div> </body> </html>