javascript


  • Hide elements with radio buttons

    Sometimes you want to show or hide certain elements of a form, depending on the selection of a radiobutton.   I am by no means any javascript ninja, but this is one simple way I came up with:  This could apply to any element. For example, you could put a whole bunch of elements in…

  • Hide elements with checkbox

    This is a slightly edited version of this post. Just to make it work with a checkbox instead of radio buttons.     [html] <html> <head> <script type="text/javascript"> function DisplayElement(checked) { if (checked) { document.getElementById(‘text’).style.display = ”; } else { document.getElementById(‘text’).style.display = ‘none’; } } </script> </head> <body> <form name="form"> <input type="checkbox" onclick="DisplayElement(this.checked)" checked/> <input…