‘null’ is null or not an object

After writing my fuel trip calculator, I learned there was a bug in IE. I got it to work but I get getting ‘meters’ is null or not an object or even worse, ‘null’ is null or not an object. I tried everything I could think of in the javascript code to get rid of that message in IE.

I realized that the function was being called twice for some reason, and that is where I finally found the culprit. The error wasn’t in the javascript, it was in the html.

When I first wrote the tool, I just called the javascript function using a button and onclick method. Then I changed it to a form so you could just hit enter in any field. But, I forgot to take out the onclick method from the submit button. So therein lied the problem. Once I removed that the error went away.

Related posts:

  1. Copy Model Object in Django I ran into a situation where I wanted to created...
  2. Django: ProgrammingError: Can’t Adapt I find I get an error like this far too...
  3. Simple PHP Pluralize I often find myself writing a if statement when I...
  4. Django: Login Form on Every Page Up to the point, when it has come to Django...

Related posts brought to you by Yet Another Related Posts Plugin.

June 6, 2008  Tags: , ,   Posted in: Programming & Internet

Comments are closed for this entry.