SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hide a select menu when image "click.gif" is click... how..?

    hi, i wish to hide a select menu when image "click.gif" is click... do you know how to make it..?

    Code:
    <img src="click.gif" onclick="hide the select menu">
    
    <select name="choice">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>

  2. #2
    Who is Mr Blonde? Mr Blonde's Avatar
    Join Date
    Sep 2006
    Location
    Gold Coast, QLD
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im not sure if this is the correct way to do it as im a novice at javascript but this is what i have

    HTML Code:
    <head>
    <script type="text/javascript">
    function swap(show,hide) {
     if (document.getElementById)
     {
      var style2 = document.getElementById(show).style;
      style2.display = "block";
      var style3 = document.getElementById(hide).style;
      style3.display = "none";
     }
    }
    </script>
    </head>
    
    <body>
    <a onclick="swap('button','hide');return false;" href="#"><img src="click.gif" alt="hide the select menu" id="button" /></a>
    
    <select name="choice" id="hide">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </body>
    and if you want to add a button to bring it back, add
    HTML Code:
    <a onclick="swap('hide','button');return false;" href="#"><img src="click.gif" alt="bring back the menu" id="button" /></a>
    Heavens Rejects : Online Clothing Store
    Alternative Clothing : Mr Blonde
    Front end development : By the Webfella


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
  •