Uncaught TypeError: Cannot set property 'src' of undefined
<p>I know this was asked before but none of the answers given fixed my problem.  Obviously a lot of people are getting the same errors with Chrome and Safari so I think an answer with an explanation would be benafitial if at all possable.  My JavaScript teacher never taught only led us down the wrong path and said to forget that so I don't understand the code I have but I have to get it working in all browsers.</p>

<p>Here is my code:</p>

<pre><code>&lt;div class="gallery" align="center"&gt;
&lt;h3&gt;Simple and Effective Photo Gallery with HTML and JavaScript&lt;/h3&gt;&lt;br/&gt;
&lt;div class="thumbnails"&gt;
&lt;img onmouseover="preview.src=img1.src" id="img1" src="img1.jpg" alt="Image Not Loaded"/&gt;
&lt;img onmouseover="preview.src=img2.src" id="img2" src="img2.jpg" alt="Image Not Loaded"/&gt;
&lt;img onmouseover="preview.src=img3.src" id="img3" src="img3.jpg" alt="Image Not Loaded"/&gt;
&lt;img onmouseover="preview.src=img4.src" id="img4" src="img4.jpg" alt="Image Not Loaded"/&gt;
&lt;img onmouseover="preview.src=img5.src" id="img5" src="img5.jpg" alt="Image Not Loaded"/&gt;
&lt;img onmouseover="preview.src=img6.src" id="img6" src="img6.jpg" alt="Image Not Loaded"/&gt;
&lt;/div&gt;&lt;br/&gt;
&lt;div class="preview" align="center"&gt;
&lt;img id="preview" src="img1.jpg" alt="No Image Loaded"/&gt;
&lt;/div&gt;
&lt;/div&gt;  
</code></pre>

<p>Please HELP!!</p>
