matt121400 Posted August 14, 2008 Share Posted August 14, 2008 ok i am able to hide/show the menu based on a radio button but how would i also be able to hide/show the label that corresponds to the menu also? I have included the code i am currently using thanks! <input type="radio" input onclick="javascript:document.getElementById('relocate').style.visibility='visible'" name="relocate2" class="fieldradio" onclick="relocate2Change(this);" /> yes <input type="radio" name="relocate2" class="fieldradio" onclick="relocate2Change(this);" /> No </span> </p> <LABEL for="relocate">Relocation: </LABEL><select name="relocate" id="relocate" style="visibility:hidden"/> <option value="No" checked='checked'>No Relocation</option> <option value=N"Alabama">Alabama</option> <option value="Alaska">Alaska</option> <option value="Arizona">Arizona</option> <option value="Arkansas">Arkansas</option> <option value="California">California</option> <option value="Colorado">Colorado</option> </select> Quote Link to comment Share on other sites More sharing options...
matt121400 Posted August 14, 2008 Author Share Posted August 14, 2008 ok so i realized i can give the label a id and do it like that but how do i do 2 input onclicks at once to make this work? Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 15, 2008 Share Posted August 15, 2008 You can make two calls within an even trigger like so: onclick="function1();function2()" But you shouldn't do that in this case. It is better to separate the javascript from the presentation. Also, you can make it much easier by just putting a span around the label and the select list and just changing the visibility of the span: <html> <head> <script type="text/javascript"> function showRelo(visiState) { document.getElementById('reloSpan').style.visibility = visiState; } </script> </head> <body> <input type="radio" name="relocate2" class="fieldradio" onclick="showRelo('visible');" />Yes <input type="radio" name="relocate2" class="fieldradio" onclick="showRelo('hidden');" checked="checked" />No <br /> <span id="reloSpan" style="visibility:hidden"> <label for="relocate">Relocation:</label> <select name="relocate" id="relocate"> <option value="No" checked='checked'>No Relocation</option> <option value=N"Alabama">Alabama</option> <option value="Alaska">Alaska</option> <option value="Arizona">Arizona</option> <option value="Arkansas">Arkansas</option> <option value="California">California</option> <option value="Colorado">Colorado</option> </select> </span> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.