专门给你程序。<div id="divTest" style="border:1px solid red;width:300px;height:300px;">
<br>
<span id="spnTest"></span>
<br>
</div><script type="text/javascript" >
var img = document.createElement("img");
img.src = "http://www.csdn.net/Images/logo_csdn.gif";
document.getElementById("divTest").appendChild(img);
o = document.getElementById("spnTest");
img.onload = function()
{
o.innerHTML = "<br />width:"+img.width+"<br />height:"+img.height;
//img.style.display = "none";
}
</script>
<br>
<span id="spnTest"></span>
<br>
</div><script type="text/javascript" >
var img = document.createElement("img");
img.src = "http://www.csdn.net/Images/logo_csdn.gif";
document.getElementById("divTest").appendChild(img);
o = document.getElementById("spnTest");
img.onload = function()
{
o.innerHTML = "<br />width:"+img.width+"<br />height:"+img.height;
//img.style.display = "none";
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货