Solved

How send number - not string with ASP to JavaScript

Posted on 2002-06-25
5
206 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Some high points and examples of what's great about Facebook React? 5 115
XML Parsing Classic ASP 5 49
Cordova Camera plugin fails 2 91
If-Then-Else ASP problem 6 46
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to dynamically set the form action using jQuery.
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now