HTML help?

Hey guys 'n gals, i’m having a stressfull time working on a dropdown menu for a client and, being a developing noobie, I think I’m making my code way too complicated.


<font id="l1b" size="4" color="black" style="cursor:pointer; color:black;"
			onclick="showSubMenu('cat2');
			document.getElementById('cat1').style.display = 'none';
			document.getElementById('cat3').style.display = 'none';
			document.getElementById('cat4').style.display = 'none';
			document.getElementById('pa1').style.display = 'none';
			document.getElementById('pb1').style.display = 'none';
			document.getElementById('pc1').style.display = 'none';
			document.getElementById('pd1').style.display = 'none';
			document.getElementById('pa2').style.display = 'none';
			document.getElementById('pb2').style.display = 'none';
			document.getElementById('pc2').style.display = 'none';
			document.getElementById('pd2').style.display = 'none';
			document.getElementById('da2a').style.display = 'none';
			document.getElementById('da2b').style.display = 'none';
			document.getElementById('da2c').style.display = 'none';
			document.getElementById('da2d').style.display = 'none';
			document.getElementById('da2e').style.display = 'none';
			document.getElementById('da2f').style.display = 'none';
			document.getElementById('da2g').style.display = 'none';
			document.getElementById('da2h').style.display = 'none';">Tea Bags<img src="arrow.png" style="position:relative; left:8px; top:3px;"></font>

this is an example- i’ve been using this stuff constantly and it’s making everything so messy, but I don’t know enough (or any) javascript that can simplify it all. Any help would be much appreciated. :cool:

Yes, that indeed is code from hell. You don’t actually need JS for a dropdown at all, though it can enhance it. Take a look at a simple dropdown like this:

http://www.pmob.co.uk/temp/dropdown_horizontal2.htm

It’s just a small amount of HTML and CSS, nice and clean. You need to tell us what kind of dropdown you are looking for, though.

Here is a link to a picture of my menu, for some strange reason I’m not able to upload pictures directly onto here :confused:http://robstest.mydnd.com/helppic.php