473,659 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

add two numbers using html

3 New Member
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 104067
drhowarddrfine
7,435 Recognized Expert Expert
No. HTML is not a programming language. Use javascript.
May 18 '07 #2
piyush jain
3 New Member
No. HTML is not a programming language. Use javascript.
thanks for the sugestion
Jun 4 '07 #3
alphaskt
1 New Member
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 Recognized Expert Expert
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
amarlol
1 New Member
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
2021
by: sekitoleko | last post by:
I need some help on representing rational numbers using structures
6
2625
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
2075
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
4641
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 real numbers. This is the floating-point representation. However as we may all know, floating-point numbers are quite inaccurate. This means that ½ might actually be represented as 0.49998, which may not be good enough for some applications. In this...
3
7929
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
2726
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 XMLReaderAdapter().setLocale((Locale)request.getAttribute("locale")) %>" TYPE="text/css"> but i get a exception
1
3439
by: Zabivb | last post by:
how to add two numbers in html using java script, no's should be user input
0
8427
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2749
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.