Spixxx Posted March 19, 2006 Share Posted March 19, 2006 Ok, here's the deal: I have a dropdown that has the values No(selected) and YesI want to have an invisible dropdown that will show if the user selects Yes above, and dissapear if they change it back to know.Things to know: My form name is "file_editor"My Yes/No dropdown name is "is_backup"My function for this is called "showSelect"Thanks for all help!! Quote Link to comment https://forums.phpfreaks.com/topic/5268-onclick-function-help/ Share on other sites More sharing options...
hitman6003 Posted March 19, 2006 Share Posted March 19, 2006 Modify as needed:[code]<script> function showDiv(a) { if (a.selectedIndex == 0) { document.getElementById('hiddendiv').style.display = "none"; } else { document.getElementById('hiddendiv').style.display = "block"; } }</script><select onchange="showDiv(this)" name="select1"> <option selected value="y">Yes</option> <option value="n">No</option></select><div id="hiddendiv" style="display: none;"><select name="select2" id="select2"> <option selected value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option></select></div>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/5268-onclick-function-help/#findComment-18903 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.