473,569 Members | 2,791 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.QueryS tring != "") {
nPage = Request.QuerySt ring("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.Qu eryString("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...Cos2Much SpamMakesUFat!
May 30 '07 #1
3 2510
"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.QueryS tring != "") {
nPage = Request.QuerySt ring("Page");
} else {
nPage = 1;
}
nPage = parseInt(Reques t.QueryString(" Page"));

nPage = cInt(Request.Qu eryString("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.c om...
"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.QueryS tring != "") {
nPage = Request.QuerySt ring("Page");
} else {
nPage = 1;
}

nPage = parseInt(Reques t.QueryString(" Page"));

>nPage = cInt(Request.Qu eryString("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.Qu eryString("Page "));
Obviously, this is VBScript. You probably want something like:

nPage = +Request.QueryS tring("Page").I tem || 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
12405
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, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server...
6
3316
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 the value of myVar. I need to know how to get the value of myVar from the script up to the server. Specifically, I'd like to have the following...
12
1442
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, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server...
6
2519
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 get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, ...
1
2688
vitmca
by: vitmca | last post by:
How to configure jndi name in Jboss. I am using sql server 2005.
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
933
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.