一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jquery javascript获取图片的宽高代码

时间:2010-08-13 编辑:简简单单 来源:一聚教程网

jquery例子

var img = $(‘#imageid');

var theimage = new image();t

heimage.src = img.attr(“src”);

alert(“width: ” + theimage.width);

alert(“height: ” + theimage.height);


js例子

var img = new image();
img.onload = function(){
 宽度=this.width
 高度=this.height
}
img.src = 图片地址;

热门栏目