using document.images.src property in javascript i want to get list of images source
<p>I am able to get it when hardcoding but throwing error while trying it with for loop.</p>

<pre><code>for(i=0;i&lt;document.images.length;i++)
       {
            document.writeln(document.images[i].src);  
       }
</code></pre>

<p>actually after printing first index value loop is terminating
error:cannot read object property src....</p>

<p>but below hardcoded one is working fine:</p>

<pre><code>document.write(document.images[0].src); 
document.write(document.images[1].src); 
document.write(document.images[2].src); 
document.write(document.images[3].src); 
</code></pre>
