473,396 Members | 1,792 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.

add two numbers using html

can we add numbers just only using html
if not then what is the best way to do the same
May 18 '07 #1
5 103702
drhowarddrfine
7,435 Expert 4TB
No. HTML is not a programming language. Use javascript.
May 18 '07 #2
No. HTML is not a programming language. Use javascript.
thanks for the sugestion
Jun 4 '07 #3
We cannot add two numbers using HTML.You can use javascript for that
the code for this program is
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script>//javascript code
  4. a=15;//initialization of variables
  5. b=20;
  6. c=a+b;//perform sum operation
  7. document.write("sum of numbers is: " +c);//print the result(+ is a concatenate operator)
  8. </script>
  9. </head>
  10. </html>
Jun 6 '07 #4
drhowarddrfine
7,435 Expert 4TB
Warning: the html and code listed in the above post is out of date (deprecated) and should not be used, though it will work. For modern methods, ask on the javascript board.
Jun 6 '07 #5
check this code out, its for a calculator



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.  
  8. <body>
  9. <form name="Calc">
  10. <table border=1>
  11. <tr>
  12. <td>
  13. <input type="text" name="Numbers" size=16 />
  14. </td>
  15. </tr>
  16. <tr>
  17. <td>
  18. <input type="button" value="  1  " onClick="document.Calc.Numbers.value += '1'"/>
  19. <input type="button" value="  2  " onClick="document.Calc.Numbers.value += '2'"/>
  20. <input type="button" value="  3  " onClick="document.Calc.Numbers.value += '3'"/>
  21. <input type="button" value="  +  " onClick="document.Calc.Numbers.value += '+'"/>
  22. <br />
  23. <input type="button" value="  4  " onClick="document.Calc.Numbers.value += '4'"/>
  24. <input type="button" value="  5  " onClick="document.Calc.Numbers.value += '5'"/>
  25. <input type="button" value="  6  " onClick="document.Calc.Numbers.value += '5'"/>
  26. <input type="button" value="  -  " onClick="document.Calc.Numbers.value += '-'"/>
  27. <br />
  28. <input type="button" value="  7  " onClick="document.Calc.Numbers.value += '7'"/>
  29. <input type="button" value="  8  " onClick="document.Calc.Numbers.value += '8'"/>
  30. <input type="button" value="  9  " onClick="document.Calc.Numbers.value += '9'"/>
  31. <input type="button" value="  x  " onClick="document.Calc.Numbers.value += '*'"/>
  32. <br />
  33. <input type="button" value="  AC  " onClick="document.Calc.Numbers.value = ' '"/>
  34. <input type="button" value="  0  " onClick="document.Calc.Numbers.value += '0'"/>
  35. <input type="button" value="  7  " onClick="document.Calc.Numbers.value += '7'"/>
  36. <input type="button" value="  =  " onClick="document.Calc.Numbers.value = eval(Calc.Numbers.value)"/>
  37. <br />
  38. </td>
  39. </tr>
  40. </table>
  41. </body>
  42. </html>
Oct 23 '11 #6

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

Similar topics

1
by: sekitoleko | last post by:
I need some help on representing rational numbers using structures
6
by: Nirjhar Oberoi | last post by:
Hi, Can you add two numbers using a Single Variable? :-) If yes then show me the code!!! Regards Nirjhar
4
by: GeekBoy | last post by:
I am reading a file of numbers using for loops. The numbers are in a grid as follows: 8 36 14 11 31 17 22 23 17 8 9 33 23 32 18 39 23 25 9 38 14 38 4 22 18 11 31 19 16 17 9 32 25 8 1 23
6
by: penny | last post by:
In this assignment we shall look at a possible representation of rational numbers in java using objects. The java language represents rational numbers using the same representation used for other...
3
by: jishara | last post by:
How to write a program in a one page to find the sum of two numbers using php $_POST method.
1
by: sathyak83 | last post by:
i want to format the numbers using css for each country ie if country is france the format=0.0.0 if country is UK=00.00 i use the below code <LINK REL=stylesheet HREF="<%= new...
1
by: Zabivb | last post by:
how to add two numbers in html using java script, no's should be user input
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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
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
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.