473,398 Members | 2,812 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,398 software developers and data experts.

Display sum in textbox in JavaScript on page as I enter values

hi,

Please provide me the solution for the coed i have provided below, as i want to display a result in average id box at the main webpage. while entering the values.



Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. </head>
  7. <script>
  8. function average()
  9.     {
  10.         var math = parseInt(document.getElementById('math').value);        
  11.         var art = parseInt(document.getElementById('art').value);
  12.  
  13.  
  14.         var result = math + art;
  15. //how could i display this result in a text box of id "average".
  16.     }
  17. </script>
  18. <body>
  19.  
  20. <input type="text" name="math" id="math" />
  21. <input type="text" name="art" id="art" />
  22. <input type="text" name="average" id="average" onmouseover="return average() " />
  23. </body>
  24. </html>
  25.  
May 30 '13 #1
3 2978
Dormilich
8,658 Expert Mod 8TB
how could i display this result in a text box of id "average".
you set the result as value of that text box.
May 30 '13 #2
Thnx Dormilich. You helped me a lot......
May 30 '13 #3
Dormilich
8,658 Expert Mod 8TB
no problem, I like helping,
May 30 '13 #4

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

Similar topics

1
by: Chris Richards | last post by:
I am working with the Windows Media Encoder SDK, and at one point in the code, I have a need to display the Property Page of a Device plugin. The only code I have for doing this is written in C++...
3
by: Ron Wallegie | last post by:
I developed a webesite using c#. I have a dropdownlist wich is filled with database values. When i click on a button on the same page all values are lost in the dropdownlist. The most common...
4
by: William LaMartin | last post by:
Is there a way to place an aspx page on a panel contained on another aspx page? I can display an HTML page on the panel using a literal can figure no way to put and aspx page there.
5
by: Homa | last post by:
Hi all, Can anyone give me some links about how to do an async web service call from aspx and display a temperary page before the web service returns? Thanks, Homa Wong
16
nirmalsingh
by: nirmalsingh | last post by:
hai experts, i am having page called main.html, when the user clicks a button in this page a popup window of pop.html is opened. in pop.html user enter his name and close that popup window. now...
3
by: Birky | last post by:
When creating a Report is there a way to display a Web page within an object? I have a scenario where I am being asked to display a report for information that is controlled and published via...
7
by: nussu | last post by:
Hi, Plz provide me javascript : javascript for a textbox to accept the values in decimals and within range i need to enter a value in textbox like 1.03 and it should be <3 (lessthan 3). Plz...
7
by: TechnoAtif | last post by:
Hi..There is again a similar problem..Now i;ve got the option values of list?menu box to show the textbox. If the option value of list is yes then the textbox is to be displayed . Can anyone...
3
NawazAhmed
by: NawazAhmed | last post by:
Hi, I am working with Visual Studio 2003, framework 1.1 I am trying to focus a textbox when page loads. I tried Page.RegisterStartupScript("focus",...
1
by: nawedita | last post by:
Hi I am facing a problem with my code .... this is what I am doing ... I am running this dropdown in while loop...and i want when i select Cheque then display textbox otherwise textbox not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
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...

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.