I am new to JavaScript and I wanted to try and make a simple rollover menu for a webpage that has images that change when you rollover with your mouse. I keep running into problems: the rollover images appear, but they are all going into the same spot.
<script language="javascript">
if (document.images) {
button1 = new Image;
button2 = new Image;
button1.src = 'mail.png';
button2.src = 'mail2.png';
button3 = new Image;
button4 = new Image;
button3.src = 'gear.jpg';
button4.src = 'gear2.jpg';
<body>
<a href="#" onmouseover="document.rollover.src=button2.src" onmouseout="document.rollover.src=button1.src">
<img src="mail.png" width="100" height="60" border=0 name="rollover"></a>
<a href="#" onmouseover="document.rollover.src=button4.src" onmouseout="document.rollover.src=button3.src">
<img src="gear.jpg" name="rollover2" border="0" width="100" height="60"></a>
</body>
}