Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function checkPostage(){
  2.     var parcelweight = $('input[name=parcelweight]').val();
  3.     var parceltype = $('#parceltype').find(":selected").text();
  4.     var success = true;
  5.     if (parceltype == "Letter"){
  6.         if (parcelweight <= 100){
  7.             removePostalError();
  8.             return success;
  9.         }else{
  10.             addPostalError();
  11.             success = false;
  12.             return success;
  13.         }
  14.     }else if (parceltype == "Large Letter"){
  15.         if (parcelweight <= 750){
  16.             removePostalError();
  17.             return success;
  18.         }else{
  19.             addPostalError();
  20.             success = false;
  21.             return success;
  22.         }
  23.     }else if (parceltype == "Small parcel"){
  24.         if (parcelweight <= 2000){
  25.             removePostalError();
  26.             return success;
  27.         }else{
  28.             addPostalError();
  29.             success = false;
  30.             return success;
  31.         }
  32.     }else if (parceltype == "Medium parcel"){
  33.         if (parcelweight <= 20000){
  34.             removePostalError();
  35.             return success;
  36.         }else{
  37.             addPostalError();
  38.             success = false;
  39.             return success;
  40.         }
  41.     }else if (parceltype == "Large parcel"){
  42.         // Any weight is OK for large parcels
  43.         removePostalError();
  44.         return success;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement