[thelist] Simple JavaScript not working head scratcher

Matt Warden mwarden at gmail.com
Fri Mar 3 15:06:31 CST 2006

On 3/3/06, fstorr <fffrancis at fstorr.demon.co.uk> wrote:
>         items[i].lastChild.insertBefore(a, items[i]);

Well, I can say that this will not work. I think what you want is:

items[i].insertBefore(a, items[i].lastChild);

However, I'm not sure what items[i].lastChild would return when there
are no children. It must not be null or you would be getting a script

I would suggest using appendChild, though. I know you said you gave it
a shot, but try it again, becuse it should work fine.


Matt Warden
Miami University
Oxford, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list