最近一段時間又忙得暈頭轉向的,終於擠出了一點時間。還是繼續做題,在做題中回顧和提高,加油,自己!
題目如下:
----------------------------------------------------------------------------------
看到“附加到DOM上”,瞬間想到了appendChild()。
<script>
var images = ['http://i8.qhmsg.com/dr/270_500_/t01a77e3c77fae3fb1d.jpg',
'http://i8.qhmsg.com/dr/270_500_/t01a77e3c77fae3fb1d.jpg',
'http://i8.qhmsg.com/dr/270_500_/t01a77e3c77fae3fb1d.jpg'];
for (i = 0; i<images.length; i++){
var img = document.createElement('img');
img.src=images[i];
document.body.appendChild(img);
}
</script>