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

Double drop-down boxes display problem

P: 1
Hi,

I'd like to put a double drop-down menu on my webpage and instead of a redirection to a new webpage, I'd like to display the result in a new section. I'm kind of stuck and I only have a triple menu here. Here an exemple of what I need.

(menu)Size, (menu) color and then display the price somewhere in a box.

Thanks a bunch

Bob


[HTML]<body>
<center>
<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">

<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>Boat lenghts</option>
<option>6-10 M</option>
<option>10-13 M</option>
<option>13-16 M</option>
<option>16+ M</option>
</select>

<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected>Dokclines lenghts </option>
</select>

<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>
</select>

[/HTML]
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript"><!--
  2. /*
  3.  _____________________________________
  4. /ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\
  5. | Another JavaScript from Uncle Jim   |
  6. | Feel free to copy, use and change   |
  7. | this script as long as this part    |
  8. | remains unchanged. You can visit    |
  9. | my website at http://jdstiles.com   |
  10. | for more scripts like this one.     |
  11. | Created: 1996 Updated: 2006         |
  12. \_____________________________________/
  13.  ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
  14. */
  15. var groups=document.isc.example.options.length
  16. var group=new Array(groups)
  17. for (i=0; i<groups; i++)
  18. group[i]=new Array()
  19.  
  20. group[0][0]=new Option("---Select2---"," ");
  21.  
  22. group[1][0]=new Option("Now Select This One"," ");
  23. group[1][1]=new Option("MAIN ONE,SUB ONE","47");
  24. group[1][2]=new Option("MAIN ONE,SUB TWO","46");
  25. group[1][3]=new Option("MAIN ONE,SUB THREE","45");
  26.  
  27. group[2][0]=new Option("Now Select This One"," ");
  28. group[2][1]=new Option("MAIN TWO,SUB ONE","115");
  29. group[2][2]=new Option("MAIN TWO,SUB TWO","116"); 
  30. group[2][3]=new Option("MAIN TWO,SUB Three","117"); 
  31.  
  32. var temp=document.isc.stage2
  33.  
  34.  
  35. function redirect(x){
  36. for (m=temp.options.length-1;m>0;m--)
  37. temp.options[m]=null
  38. for (i=0;i<group[x].length;i++){
  39. temp.options[i]=new Option(group[x][i].text,group[x][i].value)
  40. }
  41. temp.options[0].selected=true
  42. redirect1(0)
  43. }
  44.  
  45.  
  46.  
  47. var secondGroups=document.isc.stage2.options.length
  48. var secondGroup=new Array(groups)
  49. for (i=0; i<groups; i++)  {
  50. secondGroup[i]=new Array(group[i].length)
  51. for (j=0; j<group[i].length; j++)  {
  52. secondGroup[i][j]=new Array()  }}
  53.  
  54. secondGroup[0][0][0]=new Option("---Select 3---"," ");
  55. secondGroup[1][0][0]=new Option("---Select 3---"," ");
  56. secondGroup[1][1][0]=new Option("Now Select This One"," ");
  57. secondGroup[1][1][1]=new Option("M1,S1,P1","navigation.html");
  58. secondGroup[1][1][2]=new Option("M1,S1,P2","effects.html");
  59. secondGroup[1][1][3]=new Option("M1,S1,P3","utilities.html");
  60.  
  61. secondGroup[1][2][0]=new Option("Now Select This One"," ");
  62. secondGroup[1][2][1]=new Option("M1,S2,P1","http://jdstiles.com/");
  63. secondGroup[1][2][2]=new Option("M1,S2,P2","http://jdstiles.com");
  64. secondGroup[1][2][3]=new Option("M1,S2,P3","http://jdstiles.com");
  65.  
  66. secondGroup[1][3][0]=new Option("Now Select This One"," ");
  67. secondGroup[1][3][1]=new Option("M1,S3,P1","http://www.cgi-resources.com");
  68. secondGroup[1][3][2]=new Option("M1,S3,P2","http://adashimar.hypermart.net/");
  69.  
  70. secondGroup[2][0][0]=new Option("---Select 3---"," ");
  71. secondGroup[2][1][0]=new Option("Now Select This One"," ");
  72. secondGroup[2][1][1]=new Option
  73. ("M2,S1,P1","http://www.cnn.com");
  74. secondGroup[2][1][2]=new Option("M2,S1,P2","http://www.msnbc.com");
  75. secondGroup[2][1][3]=new Option("M2,S1,P3","http://www.abcnews.com");
  76.  
  77. secondGroup[2][2][0]=new Option("Now Select A Page"," ");
  78. secondGroup[2][2][1]=new Option("M2,S2,P1","http://www.news.com");
  79. secondGroup[2][2][2]=new Option("M2,S2,P2","http://www.wired.com");
  80.  
  81. secondGroup[2][3][0]=new Option("Now Select A Page"," ");
  82. secondGroup[2][3][1]=new Option
  83. ("M2,S3,P1","http://www.jdstiles.com");
  84. secondGroup[2][3][2]=new Option
  85. ("M2,S3,P2","http://jdstiles.com/index1.html");
  86. secondGroup[2][3][3]=new Option
  87. ("M2,S3,P3","http://jdstiles.com/index2.html");
  88. secondGroup[2][3][4]=new Option("M2,S3,P4","http://jdstiles.com/index3.html");
  89.  
  90.  
  91. var temp1=document.isc.stage3
  92. function redirect1(y){
  93. for (m=temp1.options.length-1;m>0;m--)
  94. temp1.options[m]=null
  95. for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
  96. temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text, secondGroup[document.isc.example.options.selectedIndex][y][i].value)
  97. }
  98. temp1.options[0].selected=true
  99. }
  100.  
  101. function redirect2(z){
  102. window.location=temp1[z].value
  103. }
[HTML]
//--></script>
</td></tr></table></FORM></center>

</body>[/HTML]
Jun 19 '07 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
You just need to change the redirect2 function to display by e.g. elem.innerHTML = whatever, instead of setting window.location.
Jan 21 '08 #2

Post your reply

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