Might be a little easier to read with a select/case   ;)  It works just like the CF one, except you need to use a break statement where you want it to stop processing.  (pretty powerful that way - can have multiple case blocks cascade)
 
 
 function checkCCAccount(Ticket) {
   var pmt = Ticket.PaymentType.options[Ticket.PaymentType.selectedIndex].value;
   switch(pmt){
    case 1:
      alert(pmt + "You must enter the account information if you are paying by Corporate Check"); 
      break;
    case 3: case 4: case 5: case 6:
      alert(pmt + "Please note that your credit card will be process at the time of the service call");
      break;
   }
 }
 
 
a lot of people dont realize you can do the same thing in cold fusion - have a multiple values for a single
case statement with delimiters in it.  i.e. -
   
<cfswitch _expression_="#myValue#">
  <cfcase value="1,2">
                <!--- for values 1, 2 --->
 </cfcase>
 <cfcase value="3,4,5,6">
                <!--- for values 3, 4, 5, 6 --->
 </cfcase>
 </cfswitch>
 
just a tid bit that gets overlooked a lot it seem, so worth mentioning :)
 
 
-Nate
----- Original Message -----
Sent: Saturday, January 24, 2004 3:59 PM
Subject: _javascript_

Ahh. My arch nemesis, _javascript_. I am having issues with this piece of code:
 
function checkCCAccount(Ticket) {
  Pmt = Ticket.PaymentType.selectedIndex
   if (Ticket.PaymentType.options[Pmt].value == 1); {
    alert(Ticket.PaymentType.options[Pmt].value + "You must enter the account information if you are paying by Corporate Check");
   }
   else if (Ticket.PaymentType.options[Pmt].value == 3); {
    alert(TIcket.PaymentType.options[Pmt].value + "Please note that your credit card will be process at the time of the service call");
   }
   else if (Ticket.PaymentType.options[Pmt].value == 4); {
    alert(TIcket.PaymentType.options[Pmt].value + "Please note that your credit card will be process at the time of the service call");
   }
   else if (Ticket.PaymentType.options[Pmt].value == 5); {
    alert(TIcket.PaymentType.options[Pmt].value + "Please note that your credit card will be process at the time of the service call");
   }
   else (Ticket.PaymentType.options[Pmt].value == 6); {
    alert(TIcket.PaymentType.options[Pmt].value + "Please note that your credit card will be process at the time of the service call");
   }
  }
 
I keep getting a syntax error. Any takers?
 
Thanks,
 
Bruce


-------------------------------------------------------------------------------
This message was processed by Mail Filter Extension
http://sssolutions.net/mf/
-------------------------------------------------------------------------------

Reply via email to