修改图片大小遇到的奇怪问题

本希望修改图片大小,结果出现了奇怪的结果;
代码如下

script:
[code="java"]
$(document).ready(function(){
$("#test1").click(function (){
// $("img").animate({
// width: $(this).width() *2,
// height: $(this).height() *2
// });
$("#img1").animate({
width: $(this).width() *2,
height: $(this).height() *2
});
alert($("#img1").html());
});
$("#test2").click(function (){
alert($("img").width()+":"+$("img").height());
});
[/code]
[code="java"]






[/code]

代码运行结果;图片被缩小到1/2;
alert出的html为空。。。。

是什么原理?百思不得其解,望指教

.html()是类似

abcdefg
这种情况下
里面的数据

没有扩起来 所以html()当然为空

html()和js中的innerHTML类似

width和height使用百分比,你想获得img的属性使用
$('#img1').attr("width")
$('#img1').attr("height")