SOURCE

console 命令行工具 X clear

                    
>
console
let images = [
'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=3899564049,2992253906&fm=58',
'https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=4111124523,748815254&fm=58',
'https://ss2.baidu.com/6ONYsjip0QIZ8tyhnq/it/u=840376355,1817251098&fm=58',
'https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=4040753437,1974205968&fm=58',
];
let count = 0; 
let imgs = document.getElementsByClassName('img');
function loadImg(images) {
let that = this;
if (count == images.length) { return false }
let img = new Image();
img.src = images[count];
img.onload = function (e) {
imgs[count].src = img.src;
count++;
setTimeout(function(){
that.loadImg(images)
},1000)
}
}
loadImg(images);
<script type="text/javascript">
var obj=new Image();
obj.src="http://www.phpernote.com/uploadfiles/editor/201107240502201179.jpg";
obj.onload=function(){
alert('图片的宽度为:'+obj.width+';图片的高度为:'+obj.height);
document.getElementById("mypic").innnerHTML="<img src='"+this.src+"' />";
}
</script>
<div id="mypic">onloading……</div>



<script type="text/javascript">
var obj=new Image();
obj.src="http://www.phpernote.com/uploadfiles/editor/201107240502201179.jpg";
obj.onreadystatechange=function(){
if(this.readyState=="complete"){
alert('图片的宽度为:'+obj.width+';图片的高度为:'+obj.height);
document.getElementById("mypic").innnerHTML="<img src='"+this.src+"' />";
}
}
</script>
<div id="mypic">onloading……</div>