Use an array, you can also simplify your function a lot by using
jQuery (although it will certainly add overhead):

var items = [];
$('.-list-tem:contains(Item Name)').each(function(){
   items.push(this);
});


On Feb 22, 8:38 am, rhhhmon <[email protected]> wrote:
> Hey guys,
>
> So here's my problem. I want to scan the whole page of the website.
> I'm trying to locate 2 datas, then I will put each data into a
> separate variable.
>
> var listitem, thislist, itemname1, itemname2;
> listitem = getElementsByClass('-list-item');
> for(var i = 0; i < listitem.length; i++) {
>         if(listitem[i].innerHTML.match(/Item Name:/)) {
>                 itemname1 = listitem[i];
>         }
>
> }
>
> When the for loop scanned the whole -list-item class, and if it find
> the Item Name: string then it will put that to itemname1. However,
> there's another Item Name: string in the website. So I need to put the
> other one to itemname2.
>
> I don't know how to do that. I'm pretty newbie boss! Please tell me
> how to do that and I'll remember it forever!
>
> Raymond
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to