js 获取图片尺寸 var image = new Image();//new一个image对象 image.src="images/bg.png"; //image.width; //image.height; alert("尺寸:"+image.height+"×"+image.width );为什么这样写不能获取到height与width 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 因为你ALERT的时候图片还没加载完;这样:var image = new Image();//new一个image对象 image.src="images/bg.png"; image.onload=function(){ alert("尺寸:"+image.height+"×"+image.width ); } //image.width; //image.height; 求助正则表达式:0.5至100的写法 老是提示 board 为空或不是对象。。。 move an image within a DIV --- 拖动(drag)image向下移动? xpath轴 视频浮动代码问题, 文本框内容被程序改变,但onchange事件没有响应? 请问最后一个this是什么的? javascript粗潜问题 JS 弹出层 怎么实现所见既所得,如DREAMWEAVER的编辑网页的功能? 搜狗高速浏览器删除cookies问题 选项卡问题!
var image = new Image();//new一个image对象
image.src="images/bg.png";
image.onload=function(){
alert("尺寸:"+image.height+"×"+image.width );
}
//image.width;
//image.height;