工作中遇到要获取图片的原始大小做展示切换
总结方法,以便后续查看
<script>
var OriginImage = new Image();
function GetImageWidth(oImage)
{
if (OriginImage.src != oImage.src)
OriginImage.src = oImage.src;
return OriginImage.width;
}
function GetImageHeight(oImage)
{
if (OriginImage.src != oImage.src)
OriginImage.src = oImage.src;
return OriginImage.height;
}