This 开发者_开发问答is pretty rudimentary, but I want to know how I can access a property like height as a string. The mouseover alert here simply returns "undefined" (and saying height.value in the alert doesn't help either):
<html>
 <body>
  <div id="wut" align="center" height="10" onmouseover="alertheight()">
    hi.
  </div>
  <script type="text/javascript">
    function alertheight() {
        alert(document.getElementById("wut").height);
    }
  </script>
 </body>
</html>
This is because most HTML elements do not have a height property (and those that have may not necesarely indicate the height in pixel). So the height attribute you added to the div-tag is ignored by the browser. Use css styles to define the heights of div's and other elements:
<div id="wut" align="center" style="height: 10px" onmouseover="alertheight()">
What I guess you are looking for however is likely clientHeight and similar properties: https://developer.mozilla.org/en/DOM/element.clientHeight
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论