怎么提取出图片的width 和height值    菜鸟一枚  求指导

解决方案 »

  1.   

    jquery的 width() height()函数
      

  2.   

    获取ID,直接取("#ID").height();("#ID").width();
      

  3.   

    饿     能请各位大神给点代码么  我这东西一直没搞懂   主要运用时HTML 和  Javascript
      

  4.   

    <HTML>
     
        <HEAD>
     
            <TITLE></TITLE>
     
            <script language="javascript">
     
            function getW()
     
            {
     
                var theImg = document.getElementById('Blue hills');
     
                alert(theImg.width);
     
            }
     
            function getH()
     
            {
     
                var theImg = document.getElementById('Blue hills');
     
                alert(theImg.height);
     
            }
     
            </script>
     
        </HEAD>
     
     
     
        <BODY>
     
            <img id="Blue hills" src = "" border="0"/>
     
            <input type="button" value="get Width" onclick="getW()"/>
     
            <input type="button" value="get Height" onclick="getH()"/>
     
        </BODY>
     
    </HTML>
    这样的一段代码  我要怎样提取图片的高宽
      

  5.   

     function getW()
      
      {
      
      var theImg = document.getElementById('Blue hills');
      
      alert(theImg.style.width);
      
      }
      
      function getH()
      
      {
      
      var theImg = document.getElementById('Blue hills');
      
      alert(theImg.style.height);
      
      }
      

  6.   


    呃。你这样已经可以提取到了
    宽:getW()
    高:getH()
      

  7.   

    我崩溃,你自己src都没设置,不是叉叉你就成神仙了
      

  8.   

    img id="Blue hills" src = "" border="0"/> 没有指定src地址,楼主要以后要细心