x
 
<!DOCTYPE html>
<html>
<body>
<img id="myImg" src="/i/photo/beijing.jpg" style="width:750px;height:500px;">
<p>在此例中,图像的高度最初为 1000 像素。我们使用 CSS 将图像设置为 500 像素高。</p>
<p>单击该按钮可显示图像的原始高度。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myImg").naturalHeight;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>