Javascript Menu Highlight Problem

Just got back from DevShed Forums where I couldn’t post links or code because I didn’t have any posts because I hadn’t posted anywhere. Just letting you know I appreciate being able to do that stuff as I don’t want to waste more time B.S.ing around just so I can post my question.


Okay, I’m doing question 1 on this test (link contains details about what my code should do and also has a screencap of the end result.

My code so far is this:

<script language="javascript">
		function initPage() {
				document.getElementById('item1').onmouseover = over;
				document.getElementById('item2').onmouseover = over;
				document.getElementById('item3').onmouseover = over;
				document.getElementById('item3').onmouseover = over;
				document.getElementById('item1').onmouseout = over;
				document.getElementById('item2').onmouseout = over;
				document.getElementById('item3').onmouseout = over;
				document.getElementById('item3').onmouseout = over;
			}
			function over(evt) {
				var evt = (evt) ? evt : ((window.event) ? event : null);
				//alert (evt.type); <-- gives access to the EVENT TYPE by showing what to call it!
				var button = document.getElementById(this.id);
				var text = document.getElementById(this.id);
				if (evt.type == 'mouseover') {
					button.style.border = '3px solid blue';
					button.style.width = '24px';
					text.style.marginLeft = '20px';
				} else if (evt.type == 'mouseout') {
					button.style.border = '';
					button.style.width = '';
					text.style.marginLeft = '';
				}
			}
	</script>

And here is the HTML:

<body onload="initPage()">
    <div id="item1"><div id="bullet1"></div><div id="text1">Menu Item #1</div></div>
    <div id="item2"><div id="bullet2"></div><div id="text2">Menu Item #2</div></div>
    <div id="item3"><div id="bullet3"></div><div id="text3">Menu Item #3</div></div>
    <div id="item4"><div id="bullet4"></div><div id="text4">Menu Item #4</div></div>
</body>

And just so you can see what I have got thus far, here is a screencap and [url=http://omega.uta.edu/~jac8618/menuHighlight_jc.htm]the file itself.

It’s 3:30 in the morning and I’m exhausted and I needed this turned in hours ago, but I just can’t seem to get it to work 100%.

I really do appreciate any and ALL help you guys can give me! Thank you in advance!