Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Re: Quick html form drop down size fix
Old 03-04-2010, 01:33 AM Re: Quick html form drop down size fix
Junior Talker

Posts: 1
Name: Nick Knight
Trades: 0
I have the need to create a small form with a select box with three choices. Choice 1, choice 2 choice3. Choice 1 shows content in a specified area and hides choice 2,3 , Choice 2 Hides Choice 1
__________________
Nick_Knight
Nick_Knight3 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-06-2010, 06:08 AM Re: Quick html form drop down size fix
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
This will give you something to ponder.

HTML Code:
<html>
  <head>
    <script type="text/javascript">
      var toggle_div_settings = {'container_type': 'DIV', 'class_name': {'visible':'box_visible', 'hidden':'box_hidden'}};
      function toggleDiv(source, container_name) {
        if (document.getElementById(container_name)) {
          var box_children = document.getElementById(container_name).getElementsByTagName(toggle_div_settings.container_type);
          if (box_children.length > 0) {
            for (var i=0; i<box_children.length; i++) {
              box_children[i].className = toggle_div_settings.class_name.hidden;
            }
          }
          if (document.getElementById(source.options[source.options.selectedIndex].value)) {
            document.getElementById(source.options[source.options.selectedIndex].value).className = toggle_div_settings.class_name.visible;
          }
        }
      }
    </script>
    <style type="text/css">
      .box_visible {
        display:block;
      }
      .box_hidden {
        display:none;
      }
    </style>
  </head>
  <body>
    <select onChange="toggleDiv(this, 'boxes');">
      <option value="div_1">1</div>
      <option value="div_2">2</div>
      <option value="div_3">3</div>
    </select>
    <div id="boxes">
      <div id="div_1" class="box_visible">Box 1</div>
      <div id="div_2" class="box_hidden">Box 2</div>
      <div id="div_3" class="box_hidden">Box 3</div>
    </div>
  </body>
</html>
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Reply     « Reply to Re: Quick html form drop down size fix
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14265 seconds with 12 queries