DOM1 Javascript not working
<p>I probably did this the wrong way, I learned Jquery first and easy stuff.  Taking a course in javascript learning DOM0 &amp; DOM1 and just cannot get this to work.</p>

<pre><code>&lt;!DOCTYPE html&gt;

&lt;html lang="en"&gt;

&lt;head&gt;
&lt;script type="text/javascript"&gt;
     function addBorder(){
          for var i=0; i&lt;document.getElementsByTagName('img').length; i++) {
               document.getElementsByTagName('img')[i].style.border="3px solid red");
          }
     }
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
     window.onload=addBorder;
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;img src="image1.jpg" /&gt;
&lt;img src="image2.jpg" /&gt;

&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>Quickly typed, ignore typos if there are any.  Results in no errors and no activity.</p>

<p>Tried it all different ways, DOM0 document.images..., window.onload=function(){....</p>

<p>Always nothing.  Get the basic idea that images are loading after script, if placed in body it works fine.  But why would it not work within window.onload=??</p>
