Solved

How send number - not string with ASP to JavaScript

Posted on 2002-06-25
5
209 Views
Last Modified: 2013-11-19
How send number - not string with ASP to JavaScript,
or how convert string to number in JavaScript.

(VB Script have function CInt, and i need the same in JavaScripT, but I cant find it)

please help,
Kely
0
Comment
Question by:IndiraK
5 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 50 total points
ID: 7108609
in javascript you use parseInt function.

var number1 = parseInt("1");
0
 
LVL 8

Expert Comment

by:drittich
ID: 7108635
Try this:

//create string
var a = '2';
//convert to type number
a = a * 1;

0
 
LVL 18

Expert Comment

by:mgfranz
ID: 7108736
theVar = number(5)
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 7109395
With JavaScript I assume that you mean a client side script?

If you are using something like:

<%
strNumber="42"
%>
<script language="JavaScript">
var num=<%=strNumber%>;
</script>

The created client side script will look like:

<script language="JavaScript">
var num=42;
</script>

This will be stored as a numeric value in the javascript variable. The client side script hasn't the faintest idea that the value once was a string in asp.

If you have problems with values like this, it might be the way you are using them later on. Do you have any code we can look at?
0
 
LVL 4

Expert Comment

by:Wakie
ID: 9355506
It appears this question has been abandoned.

I will leave a recommendation in the Cleanup topic area that this question will be:

- Points to naveenkohli -

Please leave any comments here within the next seven days.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Wakie,
EE Cleanup Volunteer.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question