Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Server Side Javascript

Reply
Thread Tools

Server Side Javascript

 
 
Simon Harris
Guest
Posts: n/a
 
      05-30-2007
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!


 
Reply With Quote
 
 
 
 
Tim Slattery
Guest
Posts: n/a
 
      05-30-2007
"Simon Harris" <too-much-> 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
 
Reply With Quote
 
 
 
 
Simon Harris
Guest
Posts: n/a
 
      05-30-2007
Tim - Thank you! )

"Tim Slattery" <> wrote in message
news:...
> "Simon Harris" <too-much-> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call server side function for client side JavaScript? =?Utf-8?B?bGFuZW0=?= ASP .Net 3 03-30-2005 02:18 PM
server side code access the text of <asp:label> changed by client-side javascript code? nick ASP .Net 3 12-15-2004 06:26 PM
Run Server-side Function *immediately after* executing client-side JavaScript. Guadala Harry ASP .Net 4 06-15-2004 07:04 AM
suggestions on: Create/delete/modify element(s) for server side from Javascript/client-side? Shaul Feldman ASP .Net 0 04-16-2004 09:55 PM
Calling client side Javascript from a server side button =?Utf-8?B?Qw==?= ASP .Net 1 01-16-2004 05:56 PM



Advertisments