SPAM-LOW: Re: [thelist] does JavaScript have an equivalent to IsDefined()?

Peter Brunone ( peter at
Mon Dec 13 10:39:29 CST 2004

	I don't think I even saw this post (although being a
sleep-deprived new father of two, that doesn't surprise me)...

	With VBScript, if the querystring parameter doesn't exist, it
comes back as an empty string.  I would have thought this was a
platform-specific condition, but if not, let me know and we'll try
something else.

	You could always try if(!Request.QueryString('id')) and see
where that gets you...


-----Original Message-----
From: thelist-bounces at On Behalf Of Sam Foster

(this was languishing in my drafts folder from god knows when, but it 
might still prove useful to someone?)

Sarah wrote:
> More ASP/JavaScript woes :) Is there a JavaScript equivalent to the
> ColdFusion IsDefined() function? I would like to be able to test to
> 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') //...

You should check the value of
	typeof Request.QueryString('id');
if it's undefined, it should give you a string 'undefined'..


* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: 
Workers of the Web, evolt ! 

More information about the thelist mailing list