Solved

How send number - not string with ASP to JavaScript

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
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.
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 how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

19 Experts available now in Live!

Get 1:1 Help Now