473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to force type cast ?

a simple question... I have a case where I' dlike to add values as
numbers and they seem to get added as a string concatination. how do I
force the + to add the values as numbers?

this is in an <INPUT onchange="OrderForm.TotalCharge.value=this.value
+ 1;" >

a related question is that I have some other calculations to do in
addition to this one-liner, so I am assuming I should write a little
<SCRIPT> function and just make the onchange="MyReCalc();"

thanks,

d
Jul 20 '05 #1
2 30936

"dan baker" <bo*****@yahoo.com> wrote in message
news:13**************************@posting.google.c om...
a simple question... I have a case where I' dlike to add values as
numbers and they seem to get added as a string concatination. how do I
force the + to add the values as numbers?

this is in an <INPUT onchange="OrderForm.TotalCharge.value=this.value
+ 1;" > <snip>

<URL: http://jibbering.com/faq/#FAQ4_21 >

- and -

<URL: http://www.litotes.demon.co.uk/js_in...e_convert.html


Richard.
Jul 20 '05 #2
"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
a simple question... I have a case where I' dlike to add values as
numbers and they seem to get added as a string concatination. how do I
force the + to add the values as numbers?

this is in an <INPUT onchange="OrderForm.TotalCharge.value=this.value
+ 1;" >

<snip>
------------------------------


thanks... I figured that the INPUT was treating things as text
strings, but had not found the parseInt() and parseFloat() functions
before.

d
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NotYetaNurd | last post by:
Hi all, I read that delegates are type safe and Functional pointers are not!!... in this context what does type safety mean? can anyone of you throw some light on it regards, ...
3
by: mra | last post by:
I want to cast an object that I have created from a typename to the corresponding type. Can anycone tell me how to do this? Example: //Here, Create the object of type "MyClass" object...
12
by: Jeremy Chapman | last post by:
I want to access the viewstate of a page object from outside of the class (in a helper class), so I made a class inherited from Page, and exposed a property that returns the viewstate object. I my...
7
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return...
16
by: Martin Jørgensen | last post by:
Hi, Short question: Any particular reason for why I'm getting a warning here: (cast from function call of type int to non-matching type double) xdouble = (double)rand()/(double)RAND_MAX;
5
by: Eric bouxirot | last post by:
hi, i'd like to do a "cast", who seem to be very complicated in .NET. in C standard it's so easy... i explain : i have made an app based on plugin architecture in VB.NET. all work fine.. ...
2
by: hardieca | last post by:
Hi! I have a CreateUserWizard control with the usual suspects of validators. As you're probably aware, each validator is associated with one of CreateUserWizard's child controls. When a user...
14
by: andreyvul | last post by:
g++ says a reinterpret cast from void* is disallowed; however, all I'm trying to do is de-capsulate a void* argument that holds the pointer to a class (and static_cast forces cast constructor) any...
3
by: Julie | last post by:
Here's the scenario (public attributes, etc. omitted for brevity): class Base { } class Derived : Base { }
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.