Server Side Javascript

Discussion in 'ASP General' started by Simon Harris, May 30, 2007.

  1. Simon Harris

    Simon Harris Guest

    Hi All,

    I have just taken on maintenance of an app developed in ASP with JavaScript
    as the language.

    I am struggling with carrying out some math on a value derived from the
    querystring:

    if (Request.QueryString != "") {
    nPage = Request.QueryString("Page");
    } else {
    nPage = 1;
    }

    How do I program this so that nPage is an integer, rather than a string when
    it comes from the querystring? I have tried this:

    ....
    nPage = cInt(Request.QueryString("Page"));
    ....

    This results in the following error:
    Microsoft JScript runtime error '800a138f'
    Object expected

    If I don't do this, when I use the variable nPage later on (To add it to
    another number) I get NaN error. (Not a number - E.g Trying to add a string
    to a number)

    Any help will be much appreciated.

    Thank you.

    Simon.

    --
    --
    * Please reply to group for the benefit of all
    * Found the answer to your own question? Post it!
    * Get a useful reply to one of your posts?...post an answer to another one
    * Search first, post later : http://www.google.co.uk/groups
    * Want my email address? Ask me in a post...Cos2MuchSpamMakesUFat!
     
    Simon Harris, May 30, 2007
    #1
    1. Advertising

  2. Simon Harris

    Tim Slattery Guest

    "Simon Harris" <> wrote:

    >Hi All,
    >
    >I have just taken on maintenance of an app developed in ASP with JavaScript
    >as the language.
    >
    >I am struggling with carrying out some math on a value derived from the
    >querystring:
    >
    >if (Request.QueryString != "") {
    > nPage = Request.QueryString("Page");
    >} else {
    > nPage = 1;
    >}


    nPage = parseInt(Request.QueryString("Page"));


    > nPage = cInt(Request.QueryString("Page"));
    >...
    >
    >This results in the following error:
    > Microsoft JScript runtime error '800a138f'
    > Object expected


    Yup. cInt is a VBScript function. JScript doesn't knkow what it is.

    --
    Tim Slattery
    MS MVP(DTS)

    http://members.cox.net/slatteryt
     
    Tim Slattery, May 30, 2007
    #2
    1. Advertising

  3. Simon Harris

    Simon Harris Guest

    Tim - Thank you! :eek:)

    "Tim Slattery" <> wrote in message
    news:...
    > "Simon Harris" <> wrote:
    >
    >>Hi All,
    >>
    >>I have just taken on maintenance of an app developed in ASP with
    >>JavaScript
    >>as the language.
    >>
    >>I am struggling with carrying out some math on a value derived from the
    >>querystring:
    >>
    >>if (Request.QueryString != "") {
    >> nPage = Request.QueryString("Page");
    >>} else {
    >> nPage = 1;
    >>}

    >
    > nPage = parseInt(Request.QueryString("Page"));
    >
    >
    >> nPage = cInt(Request.QueryString("Page"));
    >>...
    >>
    >>This results in the following error:
    >> Microsoft JScript runtime error '800a138f'
    >> Object expected

    >
    > Yup. cInt is a VBScript function. JScript doesn't knkow what it is.
    >
    > --
    > Tim Slattery
    > MS MVP(DTS)
    >
    > http://members.cox.net/slatteryt
     
    Simon Harris, May 30, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Qw==?=
    Replies:
    1
    Views:
    3,277
    Hermit Dave
    Jan 16, 2004
  2. Shaul Feldman
    Replies:
    0
    Views:
    872
    Shaul Feldman
    Apr 16, 2004
  3. Guadala Harry
    Replies:
    4
    Views:
    1,547
    =?Utf-8?B?aGFyaSBwcmFzYWQ=?=
    Jun 15, 2004
  4. nick
    Replies:
    3
    Views:
    3,246
    Eliyahu Goldin
    Dec 15, 2004
  5. =?Utf-8?B?bGFuZW0=?=
    Replies:
    3
    Views:
    29,361
    Eliyahu Goldin
    Mar 30, 2005
Loading...

Share This Page