473,410 Members | 1,953 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,410 software developers and data experts.

Add the contents of 2 Texbox's

Right, ok, well I have designed a form that will display a price (22.34) in
a text box, and another price in the other text box... I also have a blank
text box... Now I want to add both the prices together and get a total in
the bloank textbox..
I got this example off a website sumwhere.. But it does not display the
decimal number, it only displays the whole number

PLEASE HELP

var number1 = parseInt(document.forms[0].CasesSellingPrice.value);
var number2 = parseInt(document.forms[0].AccessoriesSellingPrice.value);
document.forms[0].total.value = number1 + number2;

Thanks In Advance
Jul 17 '05 #1
1 1868
Phill Long wrote:
PLEASE HELP

var number1 = parseInt(document.forms[0].CasesSellingPrice.value); 1 2 3 4 5

1. not needed in PHP.

2. to define a variable in PHP just assign something to it:
$number1 = 7; // or whatever

3. As far as I know PHP does not have a function parseint() defined.
What's the definition you have for it?

4. In PHP *all* variables start with a $

5. In PHP object dereference is done with ->
var number2 = parseInt(document.forms[0].AccessoriesSellingPrice.value);
I suggest you read a bit of the fine manual ( @ http://www.php.net/manual/ )
or ask your javascript questions in comp.lang.javascript
document.forms[0].total.value = number1 + number2;


I don't know javascript, but I'd never expect the sum of two integers to
be anything else than an integer.
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #2

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

Similar topics

1
by: Rostov | last post by:
I've got a script where I'm trying to toggle the visibility of a div node by a click on an image that is the sibling of the div. So I've got this HTML: <div> <img...
6
by: Foxy Kav | last post by:
Hi, another question from me again, i was just wondering if anyone could give me a quick example of reading data from a file then placing the data into an array for some manipulation then reading...
1
by: albertoalar | last post by:
I m trying to intercept a return in a texbox (Pocket pc ) when a barcode is writed. I need help thanks
1
by: Beowulf | last post by:
I have a report laid out in Design View as shown at the end of this message. I have code that performs the following steps: 1. In main report's Report_Open(), DELETE any old rows in tblTOC for...
9
by: Marcel Saucier | last post by:
Hello, I want to create several texboxes on a form and I would like to refer to them (properties, etc) in a form of an array. Is that possible ? Example: Instead of...
0
by: Yog | last post by:
Hi, How to access the value of a Texbox column(Template field) in gridview and to update a column next to it in the Gridview...! Example:Let's say there are four columns Product,Cost,Quantity...
6
by: cj | last post by:
I have textbox1 that takes a phone number xxx-xxx-xxxx. Is it possible to have it start off looking like - - and when someone types the number fill in around the -s? If not how about...
3
by: menakavenkatesh | last post by:
i want simple coding for changing fontsize of the texbox
4
by: Ken Fine | last post by:
I'm making an administrative interface that lists records in a GridView. For *each* row in the gridview, I would there to be two interface elements in addition to some information associated with...
10
by: sarega | last post by:
Here is the situation there is a list of contents from which the user can select the required contents to be displayed, but below these list of contents, the contents are actually displayed in the...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.