【发布时间】:2014-07-08 19:12:50
【问题描述】:
我想获取页面上所有图像的 href、src、width、height。 jQuery 代码是
$('img:regex(data:extension, jpg)').each(function() {
var imgsrc = $(this).attr('href');
//$(this).attr('width') =0;
var newImg = new Image();
newImg.src = imgsrc;
var width = newImg.width;
//width is 0;
});
不知道哪里出了问题,有什么想法吗?
谢谢 让
【问题讨论】:
标签: jquery image attributes