Javascript help

Discussion in 'HTML & Website Design' started by southwind19, Jul 3, 2009.

  1. #1
    I am trying to write a form for a site.

    The thing i want to do is when a person clicks on a checkbox i want to show to more textbox under it asking for details,after that. If not clicked i want the box to be hidden so that they layout and over all look is not affected :)
     
    southwind19, Jul 3, 2009 IP
  2. crath

    crath Well-Known Member

    Messages:
    661
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    100
    #2
    <script type='text/javascript'>
    function showhidden(){
         var obj = document.getElementById('hiddenarea');
         if(obj.style.display == 'block'){
              obj.style.display = 'none';
         }else{
              obj.style.display = 'block';
         }
    }
    </script>
    <input type="button" value="Show Hide" onclick="showhidden()"/>
    <div id="hiddenarea" style="display:none">
         This is hidden content...
    </div>
    HTML:
    Its not exactly how you want it, but you can play with that
     
    crath, Jul 3, 2009 IP