Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [Java][PHP]Zależnie listy rozwijane
Forum PHP.pl > Forum > Przedszkole
saviola15
Witam,
Powinno być tak jak wybiorę w pierwszej pozycji nie wiem w drugiej 0,4 bar oraz siła pchająca 5 powinnień wskoczyć w 4 być D12 a niestety tak nie jest sad.gif
http://pneumaticon.pl/selet/index.php

  1. <head>
  2. <script type="text/javascript">
  3.  
  4.  
  5.  
  6. var categories = [];
  7.  
  8. categories["startList"] = ["8","10","12","16","nie wiem"]
  9. categories["nie wiem"] = ["0,3 bar","0,4 bar","0,5 bar","0,6 bar","0,7 bar","0,8 bar","0,9 bar","1,0 bar"];
  10. categories["0,3 bar"] = ["4","6","10","15","25"];
  11. categories["0,4 bar"] = ["5","8","13", "19","32"];
  12. categories["5"] = ["D12"];
  13. categories["0,5 bar"] = ["6", "10", "15", "24"];
  14. categories["0,6 bar"] = ["7", "12", "19", "30"];
  15. categories["0,7 bar"] = ["8", "14", "22", "35"];
  16.  
  17. var nLists = 4; // number of select lists in the set
  18.  
  19. function fillSelect(currCat,currList){
  20. var step = Number(currList.name.replace(/\D/g,""));
  21. for (i=step; i<nLists+1; i++) {
  22. document.forms['tripleplay']['List'+i].length = 1;
  23. document.forms['tripleplay']['List'+i].selectedIndex = 0;
  24. }
  25. var nCat = categories[currCat];
  26. for (each in nCat) {
  27. var nOption = document.createElement('option');
  28. var nData = document.createTextNode(nCat[each]);
  29. nOption.setAttribute('value',nCat[each]);
  30. nOption.appendChild(nData);
  31. currList.appendChild(nOption);
  32. }
  33. }
  34.  
  35.  
  36.  
  37. function init() {
  38. fillSelect('startList',document.forms['tripleplay']['List1'])
  39. }
  40.  
  41. navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);
  42.  
  43. </script>
  44. </head>
  45. <body>
  46. <form name="tripleplay" action="">
  47. Srednica Tloka
  48. <select name='List1' onchange="fillSelect(this.value,this.form['List2'])">
  49. <option selected>Wybierz</option>
  50. </select>
  51.  
  52. Cisnienie
  53. <select name='List2' onchange="fillSelect(this.value,this.form['List3'])">
  54. <option selected>Wybierz</option>
  55. </select>
  56.  
  57. Teoretyczna sila pchajaca
  58. <select name='List3' onchange="getValue(this.value, this.form['List4'].value,
  59. this.form['List2'].value)">
  60. <option selected >Wybierz</option>
  61. </select>
  62. Srednica Silownika
  63. <select name='List4' onchange="getValue(this.value, this.form['List3'].value,
  64. this.form['List3'].value, this.form['List2'].value)">
  65. <option selected >Wybierz</option>
  66. </select>
  67. </form>
  68. </body>
buliq
A gdzie masz funkcję getValue()?
saviola15
Poprawiłem na :

  1. Cisnienie
  2. <select name='List2' onchange="fillSelect(this.value,this.form['List3'])">
  3. <option selected>Wybierz</option>
  4. </select>
  5. &nbsp;
  6. Teoretyczna sila pchajaca
  7. <select name='List3' onchange="fillSelect(this.value, this.form['List4'].value,
  8. this.form['List2'].value)">
  9. <option selected >Wybierz</option>
  10. </select>
  11. Srednica Silownika
  12. <select name='List4' onchange="getValue(this.value, this.form['List3'])">
  13. <option selected >Wybierz</option>
  14. </select>
  15. </form>


i nadal nie działa sad.gif
buliq
A gdzie funkcja getValue()?
Odpal konsolę zobaczysz gdzie jest błąd

this.form['List4'].value nie ma wartości, a chcesz jej użyć
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.