Page 1 of 1

How to (hopefully) stop the "has no properties"

Posted: Sat Dec 03, 2005 9:47 pm
by Red Squirrel
Been frustrated with this for hours, and it's no the first time it happends. But I think I found out once and for all what causes this.

But first here is what the problem is.

You have a form called MyForm and in your javascript you refer to it using document.MyForm.element.value and checked a 1000 times to ensure it's spelled right and it is, but it still insists that document.MyForm has no properties.

To solve this, put the startup stuff (exept global declarations) in a function

Then right at the end of the html, call that function. So it should look like this:


html head
Javascript block (including the function using the form elements)
html body
javascript block with function call to use the form elements


Since when the function get's called the html will have loaded so it will stop saying that it has no properties.


I hope this helps anyone who is having this issue. I have one red hair less after trying to debug this thing.

Archived topic from Iceteks, old topic ID:3995, old post ID:32792