image naturalWidth返回零......就是这样,为什么?
var newimage = new Image();
newimage.src = 'retouche-hr' + newlinkimage.substring(14,17) + '-a.jpg';
var width = newimage.naturalWidth;
alert (width);
Run Code Online (Sandbox Code Playgroud)
帮助,我不知道为什么!
***那道路很好,图像显示出来!
Gre*_*reg 40
我想这是因为你不是在等待图片加载 - 试试这个:
var newimage = new Image();
newimage.src = 'retouche-hr' + newlinkimage.substring(14,17) + '-a.jpg';
newimage.onload = function()
{
var width = this.naturalWidth;
alert(width);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22293 次 |
| 最近记录: |