trickell
11-19-2010, 09:59 PM
Ok, this might sound stupid but I swear, it's about to drive me crazy. how does one check whether or not a javascript "global" variable is undefined that will work with IE?
I've tried each variation of code and checked countless forums:
if (saved == undefined || saved == null) {
alert('saved');
saved = new Array();
}
returns no error and nothing happens
if (saved == 'undefined') {
alert('saved');
saved = new Array();
}
-- returns error = saved is null or not an object
if (typeof(saved) == undefined) {
alert('saved');
saved = new Array();
}
returns same as above
help me please, I'm confused more then anything.
the link is also: http://doodlekins.hcents.com/designer
Basically the if statement isn't returning true and nothing on the inside of it is ever happening.
I've tried each variation of code and checked countless forums:
if (saved == undefined || saved == null) {
alert('saved');
saved = new Array();
}
returns no error and nothing happens
if (saved == 'undefined') {
alert('saved');
saved = new Array();
}
-- returns error = saved is null or not an object
if (typeof(saved) == undefined) {
alert('saved');
saved = new Array();
}
returns same as above
help me please, I'm confused more then anything.
the link is also: http://doodlekins.hcents.com/designer
Basically the if statement isn't returning true and nothing on the inside of it is ever happening.