[thelist] JS Help...again

John Corry webshot at neoncowboy.com
Tue Feb 13 16:35:31 CST 2001


On the advice of one of the more literate JS programmers here, I got the JS
Bible and have been going through the exercises and actually getting it for
the first time.

There's this one elementary concept that just doesn't make sense
though...over and over again, I try to construct references to objects that
aren't recognized. That null or undefined error is ready to have me throw a
brick through my monitor.

For instance...

// these array elements reference
// hidden form fields, in the form named form1, in a document
// in the frame named topFrame, in the parent....
var AllProperties = new Array(22)
AllProperties[0] = parent.topFrame.document.form1.tavares_bay_home
AllProperties[1] = parent.topFrame.document.form1.tropical_hideaway
AllProperties[2] = parent.topFrame.document.form1.rays_hanawi
...

But no...I get an error from the first line in the array creation telling me
that 'parent.topFrame.document.form1.tavares_bay_home ' is null or not an
object. Why? The path of reference through the DOM looks right to me?

and this...

var PropVal = AllProperties[2].name;
		document.write (PropVal)

Would write the name of the 3rd object in that array, one would think.

But I get another error saying AllProperties.2.name is null or not an
object...great!

I'm in serious trouble when I can't even get past the simple creation of an
array to loop through looking for 'true' values...geez! I feel like if I
could just grasp the way you're supposed to refer to objects, I could do
it...everything else makes sense.

thanks,
John





More information about the thelist mailing list