# Looping function issue

**URL:** <https://forum.kirupa.com/t/looping-function-issue/262982>\
**Category:** Uncategorized\
**Created:** [June 11, 2008, 4:26pm UTC](https://forum.kirupa.com/t/looping-function-issue/262982 "2008-06-11T16:26:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitroplonker](https://avatars.discourse-cdn.com/v4/letter/n/3da27b/32.png) [@nitroplonker](https://forum.kirupa.com/u/nitroplonker)\
**Post date:** [June 11, 2008, 4:26pm UTC](https://forum.kirupa.com/t/looping-function-issue/262982/1 "2008-06-11T16:26:09Z")

</div>

ok my problem is that i want this code to look to see if “race\* includes the value of query[t]” and to apply the lower code if it is but if it’s not then to increment t by 1 and to check again. until it finds a match.

if (race\*.indexOf(querys[t]) != -1) {  
whichRace = sportEvent.childNodes\*.childNodes[0].childNodes;  
raceName = sportEvent.childNodes\*.attributes.name;  
raceLink = sportEvent.childNodes\*.childNodes[0].attributes.couponLink;  
raceBox.race.text = raceName;  
}  
else{t++};

Any help would be very appreciated

Thanks
