Getting the menu to work is easy. However, your page has serious issues that need correcting.
First - Answering the original question. The problem does not lie with the JavaScript code you supplied. Instead, it is with the menu buttons themselves. Here is your code for the ABOUT button. The problem is caused by an extra quote - highlighted in red. Remove that and the code should work.
<TD>
<A HREF="#"
ONMOUSEOVER="changeImages('index2_10', 'images/index2_10-over.jpg'); return true;"
ONMOUSEOUT="changeImages('index2_10', 'images/index2_10.jpg'); return true;" "onclick="toggle('about');">
<IMG NAME="index2_10" SRC="images/index2_10.jpg" WIDTH=56 HEIGHT=19 BORDER=0 ALT=""></A></TD>
There are several other points you would be wise to address.
1. Do not use
# for links. This looks for a reference somewhere else on the page and can screw your JavaScript up. If you want the link to point nowhere - as you obviously do - use
<a href="javascript:void(0)"> instead
2. In the script you supplied, you created a variable named
object. This is a keyword that is reserved by JavaScript. Instead use something else like
obj.
3. You have a lot of HTML comments in your code like
<!-- Start Background Stuff --!>. This format is incorrect. There should be no exclamation mark at the end of a comment. It should be
<!-- Start Background Stuff -->.
4. You have written the script for all different types of browsers.
document.getElementById('xxx') works for all modern browsers including netscape. You can therefore dispense of the rest. You could replace the entire function with this.
HTML Code:
function toggle(obj) {
document.getElementById('home').style.visibility = 'hidden';
document.getElementById('about').style.visibility = 'hidden';
document.getElementById('services').style.visibility = 'hidden';
document.getElementById('contact').style.visibility = 'hidden';
document.getElementById('gallery').style.visibility = 'hidden';
document.getElementById(obj).style.visibility = 'visible';
}
There are nicer ways of doing it, but this works fine
All of these points will help make your code faster to load and more cross-browser. I guess from your code you have let an application like photoshop build the page for you. I recommend learning to hard code HTML yourself. There are many good tutorials on the Internet and the results are much cleaner. And if you are a sad geek - like me - it is much more rewarding knowing you did it on your own.