xiah01

Untitled

Mar 27th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. function update_payment_options() {
  2. // select valid payment options according to customer type
  3. var subListArray = [];
  4. subListArray[0] = 'Select a type please';
  5. subListArray[1] = ['ca|Cash','cr|Credit','pp|PayPal'];
  6. subListArray[2] = ['sh|Shop','mt|marketTrader'];
  7. var pay = document.getElementById('paytype');
  8. var payment = document.getElementById('customerType').selectedIndex;
  9. pay.options.length = 0;
  10.  
  11. if(payment == 0){
  12. for(var i = 0; i < pay.options.length; i++) {
  13. var option_element = document.createElement('option');
  14. option_element.value = "";
  15. option_element.textContent = subListArray[i].split("|")[1];
  16. pay.appendChild(option_element);
  17. }
  18. }
  19.  
  20.  
  21. else if(payment == 1) {
  22. for(var i = 0; i < pay.options.length; i++) {
  23. var option_element = document.createElement('option');
  24. option_element.value = "";
  25. option_element.textContent = subListArray[i].split("|")[1];
  26. pay.appendChild(option_element);
  27. }
  28. }
  29.  
  30.  
  31. else if (payment == 2) {
  32. for(var i = 0; i < pay.options.length; i++) {
  33. var option_element = document.createElement('option');
  34. option_element.value = "";
  35. option_element.textContent = subListArray[i].split("|")[1];
  36. pay.appendChild(option_element);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment