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

Calculate sum of values in text boxes and display result

Hi All,

I am a new user for this forum and I need one help from you. Totally I have four text boxes in my html page. I need to calculate the total for the first three text boxes and I want that result to be displayed in the fourth text box. Right now I am working only in javascript. So, I need the solution for the above in javascript only.

Can anybody give me the solution for my query ?

--
Thanks,
RajanAish
Aug 21 '07 #1
2 10703
dmjpro
2,476 2GB
Hi All,

I am a new user for this forum and I need one help from you. Totally I have four text boxes in my html page. I need to calculate the total for the first three text boxes and I want that result to be displayed in the fourth text box. Right now I am working only in javascript. So, I need the solution for the above in javascript only.

Can anybody give me the solution for my query ?

--
Thanks,
RajanAish
Welcome To TSDN.

First try yourself.

Anyway I am giving you the solution, but next time before coming here with your code.

Expand|Select|Wrap|Line Numbers
  1. <input type = text name = a>
  2. <input type = text name = b>
  3. <input type = text name = c>
  4. <input type = text name = d>
  5.  
Expand|Select|Wrap|Line Numbers
  1. //Code for do sum.
  2. document.getElementsByName('d')[0].value = parseInt(document.getElementsByName('a')[0].value==''?'0':document.getElementsByName('a')[0].value)+
  3. parseInt(document.getElementsByName('b')[0].value==''?'0':document.getElementsByName('b')[0].value)+
  4. parseInt(document.getElementsByName('c')[0].value==''?'0':document.getElementsByName('c')[0].value);
  5.  
All the Best.

Kind regards,
Dmjpro.
Aug 21 '07 #2
acoder
16,027 Expert Mod 8TB
I've changed the thread title for you. Please use a good thread title.
Aug 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Building Blocks | last post by:
Hi, All I need is a simle calculate form script which contains this: A script that can handle text input, radio buttons, checkboxes, and dropdowns. Each one of these variables will contain a...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
1
by: Marco Simone | last post by:
Hi, I have form with several text boxes (bound and unbound). Unbounded text boxes calculates values like: txtBox5=txtBox4 + txtBox3 + txtBox2 + txtBox1 There is little delay when data in...
5
by: RC | last post by:
I have a form with three text boxes on it. I want the third text box to show the total of the values in the other two text boxes. The first box is named: BoxOne and I type the number 2 into it...
20
by: MLH | last post by:
120 MyString = "How many copies of each letter do you need?" 150 MyVariant = InputBox(MyString, "How Many?", "3") If MyVariant = "2" Then MsgBox "MyVariant equals the string '2'" If...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
5
abouddan
by: abouddan | last post by:
Hi all I am working on an accounting project using MS Access 2000, that demands to calculate many fields in a spesific record. The problem: The query I am using returns many records and for each...
3
by: coolguyraj | last post by:
I have a javascript code to take value from two text boxes and calculate on triggering the "OnBlur" function and display in the third box. The code works fine with one line item,If i have more...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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: 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:
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,...

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.