获取已知图片的高宽

// 创建对象
var imgsh = new Image();
//改变图片的src
        imgsh.src = giftIcon;
// 加载完成执行
var imgwidth=0;
var imgheight=0;
imgsh.onload = function(){
imgwidth=imgsh.width;
imgheight=imgsh.height;

猜你喜欢

转载自blog.csdn.net/u014724048/article/details/78123327