can any one tell me why this switch statement will only work once 
Author Message
 can any one tell me why this switch statement will only work once

can any one tell me why this switch statement will only work once through?

for example carrierArray = FEDEX,FEDEX-GROUND it will only execute FEDEX
then go right to the default of the switch for FEDEX-GROUND

var carrierArray = String(this.Carriers).toUpperCase().split(",");

 for(var i=0; i<carrierArray.length; i++) {
  Response.Write(carrierArray[i] + " looping... <br>")
  switch(String(carrierArray[i]))
   {
   case "UPS":
    this.GetUPS();
   break;

   case "FEDEX":
    Response.Write("Calling Express<br>");
    this.GetFedEx("Express");
   break;

   case "FEDEX-GROUND":
    Response.Write("Calling Ground<br>");
    this.GetFedEx("Ground");
   break;

   case "FEDEX-HOME":
    Response.Write("Calling Home<br>");
    this.GetFedEx("Home");
   break;

   default:Response.Write("died on: " + carrierArray[i] )
   }
  }

--
JScavitto



Tue, 24 Aug 2004 02:30:47 GMT  
 can any one tell me why this switch statement will only work once
Never mind it turn out to be an array problem.

FYI this var carrierArray = String(this.Carriers).toUpperCase().split(",");
was leaving a white space as the first char when split into an array  FEDEX,
FEDEX-GROUND, FEDEX-HOME

Joe



Tue, 24 Aug 2004 03:48:57 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Switch statement won't work! (JS/ASP)

2. Can someone tell me why this doesn't work please

3. Can you please tell me why this don't work

4. Can someone tell me why this eval() doesn't work in IE

5. writing more than one vbscript statement in one line

6. Switch statement

7. switch statement

8. Switch statement.

9. Switch Statement

10. VBS equivilent to JScript 'switch' statement

11. Switch case statement

12. switch statement

 

 
Powered by phpBB® Forum Software