Solved

How send number - not string with ASP to JavaScript

Posted on 2002-06-25
5
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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…
Suggested Courses

615 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