Server Side Javascript

S

Simon Harris

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!
 
T

Tim Slattery

Simon Harris said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top