Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How send number - not string with ASP to JavaScript

Posted on 2002-06-25
5
Medium Priority
?
221 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

688 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