Testing for omitted query string variables, how? 
Author Message
 Testing for omitted query string variables, how?

I'm writing ASP pages using JScript. I'd like to know the proper way to
check for the presence of query string parameters. I know I can do like
this:

    var page = "" + Request.QueryString("page") + "";
    if (page == "undefined") page = "default value";

But I don't like it very well. It feels like a "dirty" solution.

What is the value undefined anyway, and how do I test for it without type
casting it into a string? These variant data types makes me go nuts...

--
Best regards
Tomas Eklund, Sweden



Mon, 30 Aug 2004 02:57:49 GMT  
 Testing for omitted query string variables, how?
var page = Request.QueryString("page").Item();

Search the *scripting NGs at google for IStringList if you want a more detailed explanation...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> I'm writing ASP pages using JScript. I'd like to know the proper way to
> check for the presence of query string parameters. I know I can do like
> this:

>     var page = "" + Request.QueryString("page") + "";
>     if (page == "undefined") page = "default value";

> But I don't like it very well. It feels like a "dirty" solution.

> What is the value undefined anyway, and how do I test for it without type
> casting it into a string? These variant data types makes me go nuts...

> --
> Best regards
> Tomas Eklund, Sweden



Mon, 30 Aug 2004 05:55:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Query String variables in javascript

2. Need to get a session variable and modify a query string

3. Passing Javascript Variable as part of ASP Query String

4. Parse search string into query string?

5. String function query

6. <!--#include file="Query string"-->

7. getting query string from frame in jscript and getting frame name from another frame

8. Query String Problem

9. Query string

10. Parsing a query string

11. URL Query String Functions?

12. How can i Request value from Query String

 

 
Powered by phpBB® Forum Software