[thelist] does JavaScript have an equivalent to IsDefined()?
Sarah
poohbear at designshift.com
Mon Sep 22 15:49:46 CDT 2003
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > From: Sarah
> >
> > 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') //...
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
>is this client-side or server-side?
>
>either way, what does Request.QueryString('id') return?
Jeff,
This is server-side. When I do Response.Write(Request.QueryString('id')), I
get undefined, but if I try to compare to undefined, i.e...
if (Request.QueryString('id') != undefined) { }
...the code executes (incorrectly), and an error is thrown because the
query that follows craps out on the undefined value. *Very* perplexing!
(BTW, I've tried comparing to both undefined and 'undefined', same results
with each - which is correct?)
Thanks,
Sarah
More information about the thelist
mailing list