By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

Hiding the row based on the option selected in dropdown

P: 1
when i select "no"in dd (Is there a router available at the site)i get "Does a new Router is required to be processed" dropdown.Now i want is that whn i select no in that (2)dd i would get "Is the Router made available from existing stock"this dropdown but its not working plz help..

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  2. <head>
  3. <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  4. <title>Show/Hide</title>
  5. <script type="text/javascript">
  6. // <![CDATA[
  7. function display(obj,id1,id2) {
  8. txt = obj.options[obj.selectedIndex].value;
  9. document.getElementById(id1).style.display = 'none';
  10. document.getElementById(id2).style.display = 'none';
  11. if ( txt.match(id1) ) {
  12. document.getElementById(id1).style.display = 'block';
  13. }
  14. if ( txt.match(id2) ) {
  15. document.getElementById(id2).style.display = 'block';
  16. }
  17. }
  18. // ]]>
  19. </script>
  20. <script type="text/javascript">
  21. function display1(obj,id1,id2) {
  22. txt = obj.options[obj.selectedIndex].value;
  23. document.getElementById(id1).style.display = 'none';
  24. document.getElementById(id2).style.display = 'none';
  25. if ( txt.match(id1) ) {
  26. document.getElementById(id1).style.display = 'block';
  27. }
  28. if ( txt.match(id2) ) {
  29. document.getElementById(id2).style.display = 'block';
  30. }
  31. }
  32. // ]]>
  33. </script>
  34. </head>
  35.  
  36. <body>
  37. <table width="340" cellspacing="0" cellpadding="2">
  38. <thead>
  39. <tr>
  40. <td class="title">Is there a router available at the site :</td>
  41. <td class="field">
  42. <select name="type" onchange="display(this,'yes','no');">
  43. <option>Please select:</option>
  44. <option value="yes">Yes</option>
  45. <option value="no">No</option>
  46. </select>
  47. </td>
  48. </tr>
  49. </thead>
  50.  
  51. <tbody id="yes" style="display: none;">
  52. <tr>
  53. <td class="title">Make:</td>
  54. <td class="field"><input type="text" name="make"  /></td>
  55. <td class="title">Model:</td>
  56. <td class="field"><input type="text" name="model" /></td>
  57. </tr>
  58. <tr>
  59. <td class="title">Sr no:</td>
  60. <td class="field"><input type="srno" name="make"  /></td>
  61. <td class="title">Accesories/Card:</td>
  62. <td class="field"><input type="text" name="card" /></td>
  63. </tr>
  64. </tbody>
  65.  
  66. <tbody id="no" style="display: none;">
  67.  
  68. <tr>
  69. <td class="title"> Does a new Router is required to be processed:</td>
  70. <td class="field"><select name="info" onchange="display1(this,'yes1','no1');">
  71. <option value="-1">Select</option>
  72. <option value="Yes">Yes</option>
  73. <option value="No">No</option>
  74. </select></td>
  75. </tr>
  76.  
  77. <tbody id="no1" style="display: none;">
  78. <tr>
  79. <td class="title">Is the Router made available from existing stock:</td>
  80. <td class="field"><select name="stock"  >
  81. <option value="-1">Select</option>
  82. <option value="Yes">Yes</option>
  83. <option value="No">No</option>
  84. </select></td>
  85. </tr>
  86.  
  87. </tbody>
  88. </tbody>
  89.  
  90.  
  91.  
  92. </table>
  93. </body>
  94. </html>
Jul 20 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.