Advertisement
Mike_T

JS selection

Jun 20th, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. var dropdownProduct = document.getElementById("input_137");
  3. var paypalProduct1  = document.getElementById("input_116_1006");
  4. var paypalProduct2  = document.getElementById("input_116_1005");
  5. var paypalProduct3  = document.getElementById("input_116_1004");
  6. // Disabling PayPal products selection
  7. window.onload = function(){
  8.   paypalProduct2.disabled = true;
  9.   paypalProduct3.disabled = true;
  10. };
  11. // Corresponding selection from Dropdown to PayPal products
  12. function makeSelection() {
  13.   if (dropdownProduct.selectedIndex == 1) { // Registering one player option
  14.     paypalProduct1.disabled = false;
  15.     paypalProduct2.disabled = true;
  16.     paypalProduct3.disabled = true;
  17.     paypalProduct1.checked  = true;
  18.   } else if (dropdownProduct.selectedIndex == 2) { //Registering two players option
  19.     paypalProduct1.disabled = true;
  20.     paypalProduct2.disabled = false;
  21.     paypalProduct3.disabled = true;
  22.     paypalProduct2.checked  = true;
  23.   } else if (dropdownProduct.selectedIndex == 3) { //Registering three players option
  24.     paypalProduct1.disabled = true;
  25.     paypalProduct2.disabled = true;
  26.     paypalProduct3.disabled = false;
  27.     paypalProduct3.checked  = true;
  28.   };
  29. };
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement