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; 出现Object reference not set to an instance of an object. 弄了半天没弄好。 关于php日期比较的问题! javascript 查找问题 谢谢啦 急 添加文件框 求高手看看这个拖动那里有问题。。。 为什么有的IE不能 new ActiveXObject("MSXML2.XMLHTTP"); 请教如何解决下面的问题 高手们请来看一看,我非常急,在线等待!!!! 问一个关于关闭窗口的小问题。 谁能告诉我怎么能让一个form里的两个按钮都action到不同的页,而且得用post传递! 搜狗高速浏览器删除cookies问题 选项卡问题!
var image = new Image();//new一个image对象
image.src="images/bg.png";
image.onload=function(){
alert("尺寸:"+image.height+"×"+image.width );
}
//image.width;
//image.height;