Connecting Tech Pros Worldwide Forums | Help | Site Map

FF else if problem?

Member
 
Join Date: Dec 2006
Location: United States
Posts: 43
#1: Jan 25 '07
For some reason it seems as though firefox doesn't like the else statement. I use it often but it has been giving me a lot of troudlbe lately. Does anyone have any ideas of what I should do?

Thanks in advance.

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Jan 25 '07

re: FF else if problem?


Quote:

Originally Posted by johnhjohn

For some reason it seems as though firefox doesn't like the else statement. I use it often but it has been giving me a lot of troudlbe lately. Does anyone have any ideas of what I should do?

Thanks in advance.

Where has it been giving you problems?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Jan 25 '07

re: FF else if problem?


Quote:

Originally Posted by johnhjohn

For some reason it seems as though firefox doesn't like the else statement. I use it often but it has been giving me a lot of troudlbe lately. Does anyone have any ideas of what I should do?

Thanks in advance.

Post an example of an if else if statement that has been causing you problems. In my experience, if there's a problem in Firefox, it's because of my code not Firefox.
Member
 
Join Date: Dec 2006
Location: United States
Posts: 43
#4: Jan 26 '07

re: FF else if problem?


Ok here is the part of the code that I am having trouble with in FF. This is javascript search engine that I have been working on, but the only problem is when I keep the else statement in the script, FF will not even read the entire external file.

Expand|Select|Wrap|Line Numbers
  1. for ( i ; i<=9; i++)
  2.           {
  3.  
  4.         if (match[i]==vid){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  5.         else
  6.         if (splitter[1] != null && splitter[2]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  7.         else
  8.         if (splitter[2] != null && splitter[3]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  9.         else
  10.         if (splitter[3] != null && splitter[4]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  11.         else
  12.         if (splitter[4] != null && splitter[5]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" ")) && (match[i].match(" "+splitter[4]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  13.         else
  14.         if (splitter[5] != null && splitter[6]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" ")) && (match[i].match(" "+splitter[4]+" ")) && (match[i].match(" "+splitter[5]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};};
  15.         else
  16.         if (match[i].match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  17.         else
  18.         if (match[i].match(vid2)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  19.         else
  20.         if (info[i].match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  21.         else
  22.         if (info[i].toLowerCase().match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  23.         else
  24.         if (info[i].toLowerCase().match(vid+"</a>")){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  25.           }
Expert
 
Join Date: Oct 2006
Location: NC
Posts: 1,722
#5: Jan 26 '07

re: FF else if problem?


Change your for loop to:

Expand|Select|Wrap|Line Numbers
  1. for ( i=0 ; i<=9; i++)
Aric
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#6: Jan 26 '07

re: FF else if problem?


Quote:

Originally Posted by johnhjohn

Ok here is the part of the code that I am having trouble with in FF. This is javascript search engine that I have been working on, but the only problem is when I keep the else statement in the script, FF will not even read the entire external file.

Expand|Select|Wrap|Line Numbers
  1. for ( i ; i<=9; i++)
  2.           {
  3.  
  4.         if (match[i]==vid){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  5.         else
  6.         if (splitter[1] != null && splitter[2]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  7.         else
  8.         if (splitter[2] != null && splitter[3]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  9.         else
  10.         if (splitter[3] != null && splitter[4]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  11.         else
  12.         if (splitter[4] != null && splitter[5]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" ")) && (match[i].match(" "+splitter[4]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};}
  13.         else
  14.         if (splitter[5] != null && splitter[6]==null)    {if ((match[i].match(" "+splitter[0]+" ")) && (match[i].match(" "+splitter[1]+" ")) && (match[i].match(" "+splitter[2]+" ")) && (match[i].match(" "+splitter[3]+" ")) && (match[i].match(" "+splitter[4]+" ")) && (match[i].match(" "+splitter[5]+" "))){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;};};
  15.         else
  16.         if (match[i].match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  17.         else
  18.         if (match[i].match(vid2)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  19.         else
  20.         if (info[i].match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  21.         else
  22.         if (info[i].toLowerCase().match(vid3)){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  23.         else
  24.         if (info[i].toLowerCase().match(vid+"</a>")){newsearch[i]=info[i]+filler+match[i]+ratingg+imagerate(i) +end2;counter+=1;}
  25.           }

Your initial condition is weird. You probably made a typing mistake. You should also indent your code nicely and make good use {} so that your code is readable.
Reply


Similar JavaScript / Ajax / DHTML bytes