Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] looping through nodeList
- From: paul at novitskisoftware.com (Paul Novitski)
- Subject: [Javascript] looping through nodeList
- Date: Tue Oct 18 15:22:36 2005
At 12:55 PM 10/18/2005, Anthony Ettinger wrote:
>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.
The way I think of this:
window.onload = DoSomething;
is that the entire text of the function DoSomething() is copied to
the window.onload "variable." If you then execute:
alert(window.onload);
you'll see the DoSomething() function script there in its entirety.
One interesting ramification of this (which I've played with in other
languages but never in javascript) is the feasibility of parsing and
modifying function code stored in a variable. For example, a
function can edit a copy of itself and then call this revised form of
itself. Nasty-fun wrinkle on recursion! Those kinds of games can
produce program code that's incredibly difficult to maintain, but
it's fun to play with nonetheless.
Paul
- 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
- 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):