当前位置:asp编程网>技术教程>Javascript教程>  正文

jquery获取图片的宽度和高度

1970-01-01 08:00:00   来源:www.aspbc.com    作者:wangsdong   浏览量:2387   收藏
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://www.aspbc.com/js/jquery.js"></script>
<script type="text/javascript">
$(window).load(function(){
// 将你希望在页面完全就绪之后运行的代码放在这
var img = new Image();
img.src = $("img").attr("src");
alert('图片宽度:'+img.width+'px 高度:'+img.height+'px');
});
</script>
<div style="width:460px; height:200px;">
<img src="img/a01.jpg">
</div>
来源:asp编程网(www.aspbc.com)
作者:wangsdong
原创文章,转载请注明来源,谢谢

关于我们-广告合作-联系我们-积分规则-网站地图

Copyright(C)2013-2017版权所属asp编程网