[thelist] does JavaScript have an equivalent to IsDefined()?
jsWalter
jsWalter at torres.ws
Mon Sep 22 15:25:31 CDT 2003
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Sarah
> Sent: Monday, September 22, 2003 2:52 PM
> To: Evolt - thelist
> Subject: [thelist] does JavaScript have an equivalent to IsDefined()?
>
>
> More ASP/JavaScript woes :) Is there a JavaScript equivalent to the
> ColdFusion IsDefined() function? I would like to be able to test
> to see if
> a variable is defined in the querystring, but none of the methods I have
> tried has worked. I have tried:
> if (Request.QueryString('id') == null) //...
> if (Request.QueryString('id') == undefined) //...
> if (Request.QueryString('id') == 'undefined') //...
> if (typeof Request.QueryString('id') == undefined) //...
> if (typeof Request.QueryString('id') == 'undefined') //...
I pulled this from my snippets file...
if ( typeof ( myVar ) != "undefined" )
It is similar to your last 2 examples, but the TYPEOF is a method call, thus
needing the parens.
Don't know if it will work for Request.QueryString?
I'd like to know if it does work.
Hope this helps a little.
Walter
More information about the thelist
mailing list