在大多数情况下,把js代码放到图片标签的后面:
代码如下:
alert(document.getElementById("test").width;
script>
甚至在jquery中:
$(document).ready(function(){
alert(document.getElementById("test").width;
});
然后,只有下面的方法Chrome才点头:
$(window).load(function(){
alert($("#test").width());
});