Guest User

Untitled

a guest
Apr 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. <select class="ped" id="ped" onchange="pao()">
  2. <optgroup label="Tradicionais" id="pedido">
  3. <option value="301">301 - Super Frango</option>
  4. <option value="302">302 - Hamburguer</option>
  5. <option value="303">303 - Precheseburguer</option>
  6. <option value="304">304 - Eggs Burguer</option>
  7. <option value="305">305 - Americano</option>
  8. <option value="306">306 - Bauru</option>
  9. <option value="307">307 - Misto</option>
  10. <option value="308">308 - Queijo quente</option>
  11. <option value="309">309 - Cachorro quente</option>
  12. </optgroup>
  13. <optgroup label="Linha especial">
  14. <option value="310">310 - Sem noção</option>
  15. <option value="311">311 - Bedegueba</option>
  16. <option value="312">312 - Fortaleza</option>
  17. <option value="313">313 - Ceará</option>
  18. <option value="327">327 - TDB (Tudo de Bom)</option>
  19. </optgroup>
  20. </select>
  21.  
  22. function pao(){
  23. var sand = document.getElementById('ped');
  24. var opcpao = document.createElement('select');
  25. var p1 = document.createElement('option');
  26. var p2 = document.createElement('option');
  27. var p3 = document.createElement('option');
  28. if (sand.value == 301) {
  29. //p1.value = 301;
  30. p1.text = "Árabe";
  31. //p2.value = 301;
  32. p2.text = "Bolão";
  33. sand.appendChild(p1);
  34. opcpao.appendChild(sand);
  35. } else {
  36.  
  37. }
  38. document.body.appendChild(opcpao);
  39. }
  40.  
  41. opcpao.appendChild(p1); // insere o option no select criado
  42. sand.appendChild(opcpao); // insere o select na div #ped
  43.  
  44. pao();
  45.  
  46. function pao(){
  47. var sand = document.getElementById('ped');
  48. var opcpao = document.createElement('select');
  49. var p1 = document.createElement('option');
  50. var p2 = document.createElement('option');
  51. var p3 = document.createElement('option');
  52.  
  53. if (sand.value == 301) {
  54. //p1.value = 301;
  55. p1.textContent = "Árabe";
  56. //p2.value = 301;
  57. p2.textContent = "Bolão";
  58. opcpao.appendChild(p1);
  59. sand.appendChild(opcpao);
  60. } else {
  61.  
  62. }
  63. document.body.appendChild(opcpao);
  64. }
  65.  
  66. pao();
Add Comment
Please, Sign In to add comment