Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old May 6th, 2007, 1:40 PM   #1
paulchwd
Hobbyist Programmer
 
paulchwd's Avatar
 
Join Date: Mar 2005
Posts: 139
Rep Power: 4 paulchwd is on a distinguished road
Question Recursion problem

Hello,
My recursive function call doesnt seem to work as the alert statement after it fires

code:

var imgNumber=1;//this is the array ordinal, start at 1 because arr[0] is displayed already on page load
var numImgs=36;
var conCat;
var images = new Array();
  
   images[0]="18.jpg";
   images[1]="xx";
   images[2]="19.jpg";
   images[3]="28.jpg";
   images[4]="xx";
   images[5]="xx";
   images[6]="1.jpg";
   images[7]="21.jpg";
   images[8]="xx";
   images[9]="xx";
   images[10]="20.jpg";
   images[11]="24.jpg";
   images[12]="30.jpg";
   images[13]="27.jpg";
   images[14]="35.jpg";
   images[15]="9.jpg";
   images[16]="12.jpg";
   images[17]="15.jpg";
   images[18]="2.jpg";
   images[19]="10.jpg";
   images[20]="13.jpg";
   images[21]="14.jpg";
   images[22]="36.jpg";
   images[23]="25.jpg";
   images[24]="22.jpg";
   images[25]="xx";
   images[26]="29.jpg";
   images[27]="31.jpg";
   images[28]="32.jpg";
   images[29]="39.jpg";
   images[30]="38.jpg";
   images[31]="26.jpg";
   images[32]="37.jpg";
   images[33]="3.jpg";
   images[34]="8.jpg";
   images[35]="xx";
   images[36]="16.jpg";
   images[37]="17.jpg";
   images[38]="5.jpg";
   images[39]="34.jpg";
   images[40]="6.jpg";
   images[41]="11.jpg";
 
   
function changePic()
{
               
     if (imgNumber <= images.length-1)
       {
         if(images[imgNumber]=="xx")
         {
                    alert ("XX found")
                    imgNumber++;
                    changePic();
                    alert ("yy")
         }
        document.mainPic.src=images[imgNumber];

           
       }
      
    imgNumber++;

}

Any ideas?

Thnx
paulchwd is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoiding Stackoverflow error using recursion to solve a maze Mjordan2nd Java 1 Feb 9th, 2006 10:01 PM
cgi/perl script + IE problem joyceshee Perl 2 Jan 24th, 2006 11:10 AM
Debug recursion method() pr0gm3r Java 3 Oct 11th, 2005 12:33 PM
Recursion Mjordan2nd Coder's Corner Lounge 22 Jul 7th, 2005 11:26 AM
help with recursion problem the_new_guy_in_town Java 3 Apr 7th, 2005 3:04 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC