[Javascript] RE: Undefined is Undefined in IE 5

Lau@goldenweb.com.au lau at goldenweb.com.au
Wed Dec 10 17:33:21 CST 2003


Its not just IE5/Mac as I have IE5.00 on PC and it spits the dummy when it
encounters >>undefined<< without the quotes. The only way I've found to get
it to work is using if ( typeof(AverageStudentsObj) != "undefined" )

Peace
Lau
----- Original Message -----
From: "Roger Roelofs" <rer at datacompusa.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, December 10, 2003 10:56 PM
Subject: [Javascript] RE: Undefined is Undefined in IE 5


Bill,

I've seen this before, and I have a hunch it is IE5/Mac, but I can't
find confirmation at the moment.  I have started using the typeof
operator i.e.
if ( typeof AverageStudentsObj != "undefined" ) ...

Dan's suggestion
if ( AverageStudentsObj ) ...
will work, but will throw warnings in Mozilla's strict warnings mode.
It works, but it slows the computer down because it has to process an
exception for each one.


On Dec 10, 2003, at 1:54 AM, Dan Costea wrote:

> undefined - is a reserved key word, so you should use it without ". If
> you say: "undefined" - this is just a string. I used undefined in IE5
> and IE6 and it worked fine... But in your case, I think is better to
> use:
>
> var AverageStudentsObj = document.getElementById("AverageStudents");
> if (AverageStudentsObj)
> alert (AverageStudentsObj);
> else
> alert ('object not found');
>
>> var AverageStudentsObj = document.getElementById("AverageStudents");
>> if ( AverageStudentsObj != undefined )

Roger,

Roger Roelofs
Datacomp Appraisal Services

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list