[Javascript] RE: Undefined is Undefined in IE 5
Roger Roelofs
rer at datacompusa.com
Wed Dec 10 05:56:51 CST 2003
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
More information about the Javascript
mailing list