JS 改变图片地址,并通过图片ur地址 获取图片大小,支持IE7
[ 2008-08-31 09:32:14 | 作者: admin ]
HTML code
JScript code
<div id="divTest" style="border:1px solid red;width:300px;height:300px;">
<br>
<span id="spnTest"></span>
<br>
</div>
<br>
<span id="spnTest"></span>
<br>
</div>
JScript code
<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>
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>
评论Feed: http://blog.xg98.com/feed.asp?q=comment&id=1152
这篇日志没有评论。
此日志不可发表评论。