Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] looping through nodeList
- From: mdougherty at pbp.com (Mike Dougherty)
- Subject: [Javascript] looping through nodeList
- Date: Tue Oct 18 15:03:32 2005
It has nothing to do with parameters
When you use the window.onload=Name(); - you are assigning the results of having executed the Name
function to the window.onload method.
When you use the window.onload=Name; - you are assigning the function called Name to the
window.onload method.
On Tue, 18 Oct 2005 12:55:05 -0700 (PDT)
Anthony Ettinger <apwebdesign@xxxxxxxxx> wrote:
> Ok, I tried all the suggestion before posting, but
> couldn't get it to work either as for (item in list)
> or as for (i=0;i<list.length;i++)
>
> Been driving me crazy. I did read that the "For In"
> method won't work.
>
> The problem turns out though, is how I was calling the
> function.
>
> window.onload=Name();
>
> Needs to be without the ()'s:
>
> window.onload=Name;
>
> ..which makes sense, since you wouldn't be passing
> parameters from anywhere on the initial routine call.
>
>
>
> --- Anthony Ettinger <apwebdesign@xxxxxxxxx> wrote:
>
>> Can't seem to get this down, I get an HTML object,
>> but
>> it's length is zero.
>>
>> var anchors = document.getElementsByTagName("a");
>> alert(anchors); // yields [object HTML Collection]
>>
>> for (anchor in anchors)
>> {
>> var item = anchor;
>> alert(item); //yields length, item, namedItem
>> (once)
>> }
>>
>> at this point, I cannot figure out for the life of
>> me
>> how to access an instance of the anchors list.
>> Basically, I just want to call getAttribute("href")
>> on
>> it.
>>
>> It seems as though anchors is not really a nodeList,
>> more like a list of metadata about the nodeList.
>>
>> Thanks.
>>
>> Anthony Ettinger
>> ph: (408) 656-2473
>> web: http://www.apwebdesign.com
>> _______________________________________________
>> Javascript mailing list
>> Javascript@xxxxxxxxxx
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>>
>
>
> Anthony Ettinger
> ph: (408) 656-2473
> web: http://www.apwebdesign.com
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> __________________________________________________________
> This message was scanned by ATX
> 3:58:06 PM ET - 10/18/2005
- Follow-Ups:
- [Javascript] looping through nodeList
- From: Anthony Ettinger
- [Javascript] looping through nodeList
- References:
- [Javascript] looping through nodeList
- From: Anthony Ettinger
- [Javascript] looping through nodeList
- Prev by Date: [Javascript] looping through nodeList
- Next by Date: [Javascript] looping through nodeList
- Previous by thread: [Javascript] looping through nodeList
- Next by thread: [Javascript] looping through nodeList
- Index(es):