【发布时间】:2011-02-21 15:01:57
【问题描述】:
我正在尝试编写一些代码来打印 div 中包含的所有图像的尺寸,虽然看起来很简单,但我似乎无法让它工作。谁能指出这里的错误? 谢谢!
$(document).ready(function() {
var width = 0;
var height = 0;
var hello = "hello";
$('#imagebox img').each(function(){
width = $(this).width;
height = $(this).height;
$('#main').append(hello);
$('#main').append(width);
$('#main').append(height);
});
});
【问题讨论】:
标签: jquery image dimensions each