<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
 <script src="http://lib.sinaapp.com/js/jquery/1.6.2/jquery.min.js"></script><script type="text/javascript">
/*鼠标经过降低增加透明度 离开降低透明度*/
$(document).ready(function(){$('.header_s_li ul li').hover(function() {
   var imgheightm = $(this).attr("height");
   var imgheightma = $(this).children().children(".imgsize").attr("height");
   var ceshi;});
});</script>
<style></style>
</head><body>
<div style="height:70px;" class="header_s_li">
<ul>
<li style="height:50px;" ><a  href="#"><img class="imgsize" style="width:20px; height:20px;"  src="http://img02.taobaocdn.com/imgextra/i2/723902727/T2WNeFXoXbXXXXXXXX_!!723902727.png" /></a></li></ul>
</div>
</body>
</html>

解决方案 »

  1.   

    var imgheightm = $(this).attr("height");改为
    var imgheightm = $(this).css("height")
      

  2.   

    var imgheightm = $(this).outerHeight();
      

  3.   

    var imgheightm = $(this).attr("height");
    改成
    var imgheightm = $(this).height();var imgheightma = $(this).children().children(".imgsize").attr("height");同理
      

  4.   

    此时能获取offsetHeight以及clientHeight
    var imgheightm =this.offsetHeight;//clientHeight
    var imgheightma = $(this).children().children(".imgsize")[0].clientHeight;
      

  5.   

    var imgheightm = $(this).css("height") 
    赞同1楼