Variables accessible as window props in all browser DOMs?

Giganews Newsgroups
Subject: Variables accessible as window props in all browser DOMs?
Posted by:  Daniel (sorry-no-email@i-get-virus-and-spam.com)
Date: Wed, 9 Jul 2003

Hullo =)

Inspired by another guy's questions here I've created an isset function that
works (almost) like the one in native PHP:

function isset(variablename) {
    return(typeof(eval("window."+variablename))!='undefined');
}

I use it like if(isset('myVar') { alert(myVar); }

My question is if variables are always accessible like this, as properties
of the window object, in all browsers. I would hate it if it turned out not
to work in Opera or an older Mozilla or something like that.

Thanks,
Daniel =)

--
There are 10 kinds of people: Those who know binary and those who don't.

Replies