SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: HTML help?

  1. #1
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.
    HTML Code:
    <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.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,112
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    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.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    SitePoint Member
    Join Date
    Apr 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a link to a picture of my menu, for some strange reason I'm not able to upload pictures directly onto here http://robstest.mydnd.com/helppic.php


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •