473,503 Members | 3,247 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Server Side Javascript

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!
May 30 '07 #1
3 2509
"Simon Harris" <to***********@makes-you-fat.comwrote:
>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)
Sl********@bls.gov
http://members.cox.net/slatteryt
May 30 '07 #2
Tim - Thank you! :o)

"Tim Slattery" <Sl********@bls.govwrote in message
news:u2********************************@4ax.com...
"Simon Harris" <to***********@makes-you-fat.comwrote:
>>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)
Sl********@bls.gov
http://members.cox.net/slatteryt

May 30 '07 #3
"Simon Harris" wrote:
I have just taken on maintenance of an app developed in ASP with
JavaScript as the language.
^^^^^^^^^^
nPage = cInt(Request.QueryString("Page"));
Obviously, this is VBScript. You probably want something like:

nPage = +Request.QueryString("Page").Item || 1 // 1 is default
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.

May 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
12394
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
6
3314
by: Guadala Harry | last post by:
I have some client-side JavaScript that, among other things, calculates the value of a variable (myVar). On the server I have a stored procedure that needs to somehow receive as an input parameter...
12
1432
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
6
2518
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you...
1
2679
vitmca
by: vitmca | last post by:
How to configure jndi name in Jboss. I am using sql server 2005.
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.